Dictionary limitation

Thomas Wouters thomas at xs4all.net
Fri Aug 4 08:34:22 EDT 2000


On Fri, Aug 04, 2000 at 02:33:25PM +0200, entropia wrote:

> > How about this:
> >
> > fruitDictionary = {
> >         'apple': [],
> >         'banana': [],
> >         'spam': [],
> >         ...
> >         }

> You can use:
> fruitDictionary={'apple':applePriceList=[], 'banana':bananaPriceList=[]....}

Nope, you can't:

>>> fruitDictionary={'apple':applePriceList=[], 'banana':bananaPriceList=[]}
  File "<stdin>", line 1
    fruitDictionary={'apple':applePriceList=[], 'banana':bananaPriceList=[]}
                                           ^
SyntaxError: invalid syntax

You can't 'nest' assignment, in Python.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list