"Exploding" (**myvariable) a dict with unicode keys

D

Devin

So Python can have unicode variable names but you can't
"explode" (**myvariable) a dict with unicode keys? WTF?

-Devin
 
M

Martin v. Löwis

Devin said:
So Python can have unicode variable names but you can't
"explode" (**myvariable) a dict with unicode keys? WTF?

That works fine for me.

Regards,
Martin
 
P

Peter Otten

Martin v. Löwis said:
That works fine for me.

The OP probably means
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: f() keywords must be strings

Peter
 
D

Devin

The OP probably means


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() keywords must be strings

Peter

Yes, that's exactly what I mean.
 
M

Martin v. Löwis

Devin said:
Yes, that's exactly what I mean.

Hmm. Why did you say that Python can have unicode variable
names? In the version you are using, it can't. In Python
3.0, it can, but then, you can also use Unicode strings
as keys in **arguments, in Python 3.0.

Regards,
Martin
 
D

Devin

Hmm. Why did you say that Python can have unicode variable
names? In the version you are using, it can't. In Python
3.0, it can, but then, you can also use Unicode strings
as keys in **arguments, in Python 3.0.

Regards,
Martin

Oh. I read somewhere that UTF-8 variable names we're supported. I
thought I even saw a colleague using Kanji.
 
M

Martin v. Löwis

Oh. I read somewhere that UTF-8 variable names we're supported. I
thought I even saw a colleague using Kanji.

In source code (string literals, comments), surely. Not in variable
names, not in 2.x.

To rephrase Bruno's comment: Python supports UTF-8 as a source encoding.
That doesn't mean that you can use all Unicode characters in all places
of the code.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top