Re: default variable in python $_

2006-10-11 Thread rh0dium
Hi Maria, This is exactly what I was looking for. I (as others have asked me to) cleared my head of the other languages, but was mearly giving perl as an example indicating the compactness I was after. Thanks Maria!! MaR wrote: > rh0dium wrote: > > Hi all, > > > > So I have this simple little r

Re: default variable in python $_

2006-10-11 Thread MaR
rh0dium wrote: > Hi all, > > So I have this simple little routine.. say like this.. > > > def foo() >return {"a":"b", "b":"c"} > > if foo(): >print "Have foo" > > > Now I want the dictionary item a (ie. b) > > How can I do it the above way or do I still have to go like this.. > > def foo(

Re: default variable in python $_

2006-10-10 Thread bearophileHUGS
rh0dium: > This is where $_ in perl is awesome - There must be a default variable > in python right? A default variable may add bugs to your code, and newbies of the language may see it coming from air, so Python avoids such things. The only Python "default variable" I know of is the _ that when u

Re: default variable in python $_

2006-10-10 Thread Georg Brandl
rh0dium wrote: > Hi all, > > So I have this simple little routine.. say like this.. > > > def foo() >return {"a":"b", "b":"c"} > > if foo(): >print "Have foo" > > > Now I want the dictionary item a (ie. b) > > How can I do it the above way or do I still have to go like this.. > > d