Apologize: annoying dictionary problem, non-existing keys

2008-04-26 Thread bvidinli
Thank you all for your answers. i get many usefull answers and someone remembered me of avoiding cross-posting. i apologize from all of you, for cross posting and disturbing. that day was not a good day for me... it is my fault.. sory and have nice days... 26 Nisan 2008 Cumartesi 02:52 tarihi

Re: [Python-Dev] annoying dictionary problem, non-existing keys

2008-04-25 Thread Collin Winter
2008/4/24 bvidinli <[EMAIL PROTECTED]>: > I posted to so many lists because, > > this issue is related to all lists, > this is an idea for python, > this is related to development of python... > > why are you so much defensive ? > > i think ideas all important for development of python, softwa

Re: [Python-Dev] annoying dictionary problem, non-existing keys

2008-04-24 Thread Greg Ewing
bvidinli wrote: I posted to so many lists because, this issue is related to all lists, this is an idea for python, this is related to development of python... You shouldn't post to every group that you think might be vaguely relevant. You should pick *one* that you think is *most* relevant and

Re: [Python-Dev] annoying dictionary problem, non-existing keys

2008-04-24 Thread Gary Herron
bvidinli wrote: i use dictionaries to hold some config data, such as: conf={'key1':'value1','key2':'value2'} and so on... when i try to process conf, i have to code every time like: if conf.has_key('key1'): if conf['key1']<>'': other commands this is very annoying. in php, i

Re: annoying dictionary problem, non-existing keys

2008-04-24 Thread Steve Holden
Thanks for your reply. Another point to note: if you get a personal reply (often you will just see replies on the list, but sometimes people will also mail you directly) it is usual to make sure the list gets copied in any reply. I hope you don't mind that I am sending a copy of this message t

Re: annoying dictionary problem, non-existing keys

2008-04-24 Thread Rick King
dict also has 'get' which provides a default if the key isn't defined: a={} print a.get('a','default') default -Rick King southfield MI -- http://mail.python.org/mailman/listinfo/python-list

Re: annoying dictionary problem, non-existing keys

2008-04-24 Thread Michele Petrazzo
bvidinli wrote: i use dictionaries to hold some config data, such as: conf={'key1':'value1','key2':'value2'} and so on... when i try to process conf, i have to code every time like: if conf.has_key('key1'): if conf['key1']<>'': other commands this is very annoying. in php, i was able to c

Re: annoying dictionary problem, non-existing keys

2008-04-24 Thread Steve Holden
bvidinli wrote: I posted to so many lists because, this issue is related to all lists, No, it isn't, as you would have discovered had you bothered to read the purpose of each list. For example, python-help and python-dev are mutually exclusive. this is an idea for python, It isn't an id

Re: annoying dictionary problem, non-existing keys

2008-04-24 Thread D'Arcy J.M. Cain
On Thu, 24 Apr 2008 10:24:37 +0200 Robert Bossy <[EMAIL PROTECTED]> wrote: > Way 2: make conf a defaultdict instead of a dict, the documentation is > there: > http://docs.python.org/lib/defaultdict-objects.html Only for 2.5 and up though. -- D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democ

Re: [Python-Dev] annoying dictionary problem, non-existing keys

2008-04-24 Thread Diez B. Roggisch
bvidinli schrieb: I posted to so many lists because, this issue is related to all lists, this is an idea for python, this is related to development of python... why are you so much defensive ? i think ideas all important for development of python, software i am sory anyway hope will be

Re: [Python-Dev] annoying dictionary problem, non-existing keys

2008-04-24 Thread Karthik
bvidinli wrote: I posted to so many lists because, this issue is related to all lists, this is an idea for python, this is related to development of python... why are you so much defensive ? i think ideas all important for development of python, software i am sory anyway hope will be h

Re: annoying dictionary problem, non-existing keys

2008-04-24 Thread Arnaud Delobelle
bvidinli <[EMAIL PROTECTED]> writes: > i use dictionaries to hold some config data, > such as: > > conf={'key1':'value1','key2':'value2'} > and so on... > > when i try to process conf, i have to code every time like: > if conf.has_key('key1'): > if conf['key1']<>'': > other commands.

Re: [Python-Dev] annoying dictionary problem, non-existing keys

2008-04-24 Thread bvidinli
I posted to so many lists because, this issue is related to all lists, this is an idea for python, this is related to development of python... why are you so much defensive ? i think ideas all important for development of python, software i am sory anyway hope will be helpful. 2008/4/24

Re: annoying dictionary problem, non-existing keys

2008-04-24 Thread Robert Bossy
bvidinli wrote: i use dictionaries to hold some config data, such as: conf={'key1':'value1','key2':'value2'} and so on... when i try to process conf, i have to code every time like: if conf.has_key('key1'): if conf['key1']<>'': other commands this is very annoying. in php, i

Re: [Python-Dev] annoying dictionary problem, non-existing keys

2008-04-24 Thread Martin v. Löwis
> this is very annoying. Posting to so many lists is even more annoying. You might not get a single helpful answer just because people are so frustrated by this behavior. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] annoying dictionary problem, non-existing keys

2008-04-24 Thread Oleg Broytmann
On Thu, Apr 24, 2008 at 11:13:25AM +0300, bvidinli wrote: > if conf.has_key('key1'): > if conf['key1']<>'': > other commands > > this is very annoying. > in php, i was able to code only like: > if conf['key1']=='someth' > > in python, this fails, because, if key1 does not exists

annoying dictionary problem, non-existing keys

2008-04-24 Thread bvidinli
i use dictionaries to hold some config data, such as: conf={'key1':'value1','key2':'value2'} and so on... when i try to process conf, i have to code every time like: if conf.has_key('key1'): if conf['key1']<>'': other commands this is very annoying. in php, i was able to code