[IronPython] Django, __unicode__, and #20366

Michael Foord fuzzyman at voidspace.org.uk
Mon Feb 1 22:40:35 CET 2010


On 01/02/2010 21:35, Jeff Hardy wrote:
> On Mon, Feb 1, 2010 at 2:21 PM, Dino Viehland<dinov at microsoft.com>  wrote:
>    
>> It always prefers __unicode__ over __str__.  We can't really only call
>> __unicode__ when __str__ isn't there because __str__ is always there.
>>      
> OK - didn't realize that. Not sure it would really improve the
> behaviour all that much anyway.
>
> Anything that really needs to know the difference and support
> IronPython can just check `str is unicode` anyway.
>
> Random thought: str(x, yes_really=True) to always call __str__? :)
>    

How about having str and unicode as different objects internally - so 
IronPython can tell the difference - but fake equality and identity 
checks *inside* IronPython. :-)

Or do something a bit similar to what Python 3 does with super... 
Compile different code for str(...) and unicode(...). I think I prefer 
that to the above. :-)

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