[IronPython] Django, __unicode__, and #20366

Michael Foord fuzzyman at voidspace.org.uk
Tue Feb 2 01:01:55 CET 2010


On 01/02/2010 23:58, Jeff Hardy wrote:
> On Mon, Feb 1, 2010 at 2:46 PM, Dino Viehland<dinov at microsoft.com>  wrote:
>    
>> I could see is making unicode(foo) do something different.  If you aliased
>> unicode then you'd get str's behavior though but that might be perfectly
>> acceptable.  It's definitely a solution I had not considered and it'd
>> probably fix multiple issues.
>>      
> Presumably then str and unicode would no longer be equal? Or are you
> thinking of something fancier?
>
>    
They would still be the same object - so would continue to compare equal 
and have the same identity. What I'm suggesting is similar to how Python 
3 treats the use of super - and that is compile different code when you 
call str(...) from when you call unicode(....) - only when you use those 
literal identifiers in source code.

Any use of them other than calling them directly would continue to 
behave as IronPython does currently.

> Also, in what cases would anyone *want* to alias unicode?
>
>    
Well, like aliasing super in Python 3, with my suggestion that would 
then be broken (or at least would fall back to standard str behaviour). 
As this is uncommon anyway it shouldn't break *much* code.

All the best,

Michael


> - Jeff
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>    


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.





More information about the Ironpython-users mailing list