Re: [Python-Dev] Initialization of __builtins__

2009-10-10 Thread Eric Smith
Vinay Sajip wrote: If __builtins__ is an implementation detail which can't be relied on, should the py3k code be changed to the try: form? Or shall I just remove the checks altogether, since Unicode should always be there in 3.x? Remember that the identifier "unicode" isn't present in py3k. The

Re: [Python-Dev] Initialization of __builtins__

2009-10-10 Thread Vinay Sajip
Antoine Pitrou pitrou.net> writes: > Why do you do this? > In py3k, unicode is always enabled but it's called "str" and the name > "unicode" > doesn't exist. > That wasn't done by me but by GvR (according to svn annotate) in r55818, presumably during the stdlib porting to py3k. I just copied t

Re: [Python-Dev] Initialization of __builtins__

2009-10-10 Thread Antoine Pitrou
Vinay Sajip yahoo.co.uk> writes: > > In the py3k branch, logging has the line > > _unicode = 'unicode' in dir(__builtins__) Why do you do this? In py3k, unicode is always enabled but it's called "str" and the name "unicode" doesn't exist. > to determine the existence of Unicode support. The co

Re: [Python-Dev] Initialization of __builtins__

2009-10-10 Thread Benjamin Peterson
2009/10/10 Vinay Sajip : > Excuse my ignorance, but how come? Because __builtins__ is a module in __main__ and a dict in other places. You should always check __builtin__; __builtins__ is an implementation detail. -- Regards, Benjamin ___ Python-Dev m

[Python-Dev] Initialization of __builtins__

2009-10-10 Thread Vinay Sajip
>I'm not top-posting, but gmane is giving me a hard time :-( In the py3k branch, logging has the line _unicode = 'unicode' in dir(__builtins__) to determine the existence of Unicode support. The code in trunk, being 1.5.2 compatible, used hasattr(types, 'UnicodeType') I wanted to eliminate the