Dumb Stupid Question About List and String

Alban Nona python.koda at gmail.com
Wed Sep 1 11:11:31 EDT 2010


Hello,

seems to have the same error with python.
In fact I was coding within nuke, a 2d compositing software (not the best)
unfortunately, I dont see how I can use dictionnary to do what I would like
to do.

2010/9/1 Xavier Ho <contact at xavierho.com>

> On 2 September 2010 00:47, Alban Nona <python.koda at gmail.com> wrote:
>
>> Hello,
>>
>> So I figure out this night how to create automatically varibales via
>> vars(), the script seems to work, exept that where it should give me a list
>> like :
>> [ELM004_DIF,ELM004_SPC,ELM004_RFL,ELM004_SSS, ELM004_REFR, ELM004_ALB,
>> etc...] it gave me just one entry in my list, and the last one [ELM004_WPP]
>> Any Ideas why that please ?
>>
>> http://pastebin.com/7CDbVgdD
>
>
> Some comments:
>
> 1) Avoid overwriting global functions like list as a variable name. If you
> do that, you won't be able to use list() later in your code, and nor can
> anyone else who imports your code.
> 2) I'm a bit iffy about automatic variable generations. Why not just use a
> dictionary? What do others on comp.lang.python think?
> 3) I'm getting an error from your code, and it doesn't match with what you
> seem to get:
>
> # output
>
> ELM004_DIF
> ELM004_SPC
> ELM004_RFL
> ELM004_SSS
> ELM004_REFR
> ELM004_ALB
> ELM004_AMB
> ELM004_NRM
> ELM004_MVE
> ELM004_DPF
> ELM004_SDW
> ELM004_MAT
> ELM004_WPP
> Traceback (most recent call last):
>   File "Test.py", line 33, in <module>
>     print ELM001
> NameError: name 'ELM001' is not defined
>
> Did you get any compiler errors? I'm using Python 2.7
>
> Cheers,
> Xav
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100901/d2da631c/attachment.html>


More information about the Python-list mailing list