Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Confused by __unicode_cast and __str_cast in django.utils.functional [RSS Feed]

#1 Jan. 23, 2011 13:25:36

Kevin X.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Confused by __unicode_cast and __str_cast in django.utils.functional


Hi,

I am stuck while look into source code of Django's lazy decorator. At
line 205 of functinal.py, there is:

def __unicode_cast(self):
return self.__func(*self.__args, **self.__kw)

def __str_cast(self):
return str(self.__func(*self.__args, **self.__kw))

Why doesn't __unicode_cast function need to call *unicode* on
*self.__func(...)* like what __str_cast does,call *str* function?

Any help is appreciated.

Kevin Xiao

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 23, 2011 23:23:02

Lachlan M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Confused by __unicode_cast and __str_cast in django.utils.functional


On Sun, Jan 23, 2011 at 20:40, Kevin Xiao <kevin.xia...@gmail.com> wrote:
> Hi,
>
> I am stuck while look into source code of Django's lazy decorator. At
> line 205 of functinal.py, there is:
>
>  def __unicode_cast(self):
>            return self.__func(*self.__args, **self.__kw)
>
>  def __str_cast(self):
>            return str(self.__func(*self.__args, **self.__kw))
>
> Why doesn't __unicode_cast function need to call *unicode* on
> *self.__func(...)* like what __str_cast does,call *str* function?
>
> Any help is appreciated.

Kevin,

Almost 100% certain that this question will be answered quicker on the
django-dev list:

email: django-develop...@googlegroups.com

web:http://groups.google.com/group/django-developers?hl=encheers
L.




--
Crunchiness is the gustatory sensation of muffled grinding of a
foodstuff. Crunchiness differs from crispiness in that a crispy item
is quickly atomized, while a crunchy one offers sustained, granular
resistance to jaw action. While crispiness is difficult to maintain,
crunchiness is difficult to overcome.
from The Best of Wikipediahttp://bestofwikipedia.tumblr.com/--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Confused by __unicode_cast and __str_cast in django.utils.functional [RSS Feed]

Board footer

Moderator control

Enjoy the 13th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support