Hi Alex, Alex Gaynor wrote: > On Tue, Mar 3, 2009 at 6:29 PM, Ishwor Gurung <ish...@loopback.ath.cx>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
Thanks for your really quick reply Alex. That does make sense. Cheers, Ishwor
smime.p7s
Description: S/MIME Cryptographic Signature