re.compile.match() results in unicode strings - why?

Stefan Seefeld seefeld at sympatico.ca
Thu Nov 11 10:18:15 EST 2004


Scott David Daniels wrote:
> Axel Bock wrote:
> 
>> .... I match a string with
>>     exp = re.compile(blah)
>>     m = exp.match(string)
>>     a,b,c,d = m.groups()
>> now a,b,c,d are all string variables, 
> 
> This shows a misunderstanding.  Python does not have typed variables.

huh ? It is perfectly valid to ask what type a variable has, i.e. python
is 'strongly typed'.

>     a,b,c,d = 'a', 'b', 'c', 'd'
>     a = 4.5
>     b = 3+5j
>     c = u'\N{LATIN CAPITAL LETTER D WITH STROKE}one'
>     d = repr
> is perfectly legal.

indeed. How's this related to the original question ?

Regards,
		Stefan




More information about the Python-list mailing list