A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/108711.html below:

Python Object Question

Python Object QuestionJeff Collins jcollins at endeavors.com
Sat Apr 28 17:19:21 EDT 2001
On Sat, Apr 28, 2001 at 01:39:56PM -0700, Jason Joy wrote:
> Hello,
> 
> I am having a bit of trouble with the following piece of code...
> 
>                 result = objectChunk()
>                 masterkeys = output.keys()
>                 for key in masterkeys:
>                         result.key = output[key]

either use
			  setattr(result, key, output[key])
OR
			  result[key] = output[key]

with the __setattr__ method defined in class objectChunk


>                 ## I might have to do something different above...
>                 data.append(result)
> 
> Where result.key is, of course, taken literally as result.key, not depending
> on what the variable key is.  Does anyone know how I can make it use the
> actual value of "key"?
> 
> Please respond via Email as well as posting to the list if possible.
> 
> Jason
> 
> ____________________________________________________________________
> Get free email and a permanent address at http://www.netaddress.com/?N=1

-- 
Jeffery D. Collins, Ph.D.
Sr. Software Developer
Endeavors Technology, Inc.
http://www.endeavors.com


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4