c[:]()

Douglas Woodrow newsgroups at nospam.demon.co.uk
Thu May 31 04:07:03 EDT 2007


On Thu, 31 May 2007 08:57:56, Douglas Woodrow 
<newsgroups at nospam.demon.co.uk> wrote
>On Wed, 30 May 2007 23:23:22, Warren Stringer <warren at muse.com> wrote
>>
>>def a(): return 'b'
>>def b(): print 'polly! wakey wakey'
>>c = {}
>>c['a'] = b
>>c[a()]()  #works!
>
>
>(typo correction for other easily-confused newbies like myself)
>
>I think you mean
>,----
>| c['a']()  #works!
>`----
>

Oh no, I get it, you meant...
,----
| c['b'] = b
| c[a()]()  #works!
`----

...or was it?:-
,----
| def a(): return 'a'
`----

-- 
Doug Woodrow




More information about the Python-list mailing list