Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'variables': 0.07; 'subject:question': 0.10; 'answering...': 0.16; 'literals': 0.16; 'literals,': 0.16; 'ok!': 0.16; "{'a':": 0.16; 'variable': 0.18; 'resolved': 0.19; '>>>': 0.22; 'to:name:python-list@python.org': 0.22; '>>>': 0.24; 'received:65.55.116': 0.24; "i've": 0.25; 'switch': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'statement': 0.30; "i'm": 0.30; 'but': 0.35; 'there': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'providing': 0.61; 'such': 0.63; 'as:': 0.81; 'dict()': 0.84; 'on?': 0.91 X-TMN: [mRxRfQ1gK3Tv6wln/Qvm9UmNGjLCIGhP] X-Originating-Email: [carlosnepomuceno@outlook.com] Content-Type: multipart/alternative; boundary="_35798f79-2fba-4063-a23f-59702137c66c_" From: Carlos Nepomuceno To: "python-list@python.org" Subject: RE: Beginner question Date: Tue, 4 Jun 2013 14:23:39 +0300 Importance: Normal In-Reply-To: References: <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com>, , <1ba2ceec-f778-4c95-bf98-260fc48b4c3f@googlegroups.com>, , MIME-Version: 1.0 X-OriginalArrivalTime: 04 Jun 2013 11:23:39.0720 (UTC) FILETIME=[F6720C80:01CE6115] X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370345087 news.xs4all.nl 15929 [2001:888:2000:d::a6]:56218 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46871 --_35798f79-2fba-4063-a23f-59702137c66c_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Started answering... now I'm asking! lol I've tried to use dict() to create a dictionary to use like the switch stat= ement providing variable names instead of literals=2C such as: >>> a=3D'A' >>> b=3D'B' >>> {a:0=2Cb:1} #here the variables are resolved {'A': 0=2C 'B': 1} That's ok! But if I use dict() declaration: >>> dict(a=3D0=2Cb=3D1) {'a': 0=2C 'b': 1} #here variable names are taken as literals What's going on? Is there a way to make dict() to resolve the variables? = --_35798f79-2fba-4063-a23f-59702137c66c_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Started answering... now I'm ask= ing! lol

I've tried to use dict() to create a dictionary to use like= the switch statement providing variable names instead of literals=2C such = as:

>=3B>=3B>=3B a=3D'A'
>=3B>=3B>=3B b=3D'B'
>= =3B>=3B>=3B {a:0=2Cb:1} =3B =3B =3B #here the variables are= resolved
{'A': 0=2C 'B': 1}

That's ok! But if I use dict() decla= ration:

>=3B>=3B>=3B dict(a=3D0=2Cb=3D1)
{'a': 0=2C 'b': 1}=  =3B =3B =3B #here variable names are taken as literals

= What's going on? Is there a way to make dict() to resolve the variables?
= --_35798f79-2fba-4063-a23f-59702137c66c_--