On Tue, Mar 3, 2009 at 6:29 PM, Ishwor Gurung <[email protected]>wrote:
> Hi,
>
> What is the motive behind working on a copy of 'request.POST':
> e.g -
> if request.method == "POST":
> post = request.POST.copy()
>
> AFAIK, this implies making a copy of POST and working on it.
> Rather wouldn't it be faster if we work on request.POST directly? :
>
> if request.method == "POST:
> request.POST.has_key("cyrus") .....
>
> Both the case has same number of function lookups. Or, am i safe in
> assuming its more a preference kinda thing?
>
> Cheers,
> Ishwor
>
The reason for making a copy is that by default the POST object isn't
mutable, that is you can't change the values of it's keys, so if you'd like
to change something in order to alter parts of it you'll need to make a
copy.
Alex
--
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---