[Python-ideas] *var()*

Liam Marsh liam.marsh.home at gmail.com
Thu Jan 2 17:22:21 CET 2014


dear Jeanpierre,
sorry, no.
for >>>count1=3,
    var('count1') or var(str('count',1)) will output 3
in fact, it is even better to use libraries,
and it was stupid to send the first email before trying an other way.
sorry.

2014/1/2 Devin Jeanpierre <jeanpierreda at gmail.com>

> On Thu, Jan 2, 2014 at 3:57 AM, Liam Marsh <liam.marsh.home at gmail.com>
> wrote:
> > hello,here is my idea:
> > var():
> > input var name (str),
> > outputs var value
> > example:
> >
> >>>>count1=1.34
> >>>>var('count',1)
> > 1.34
>
>thank you and have a nice day!
>
> This is underspecified. What should it do for this code?
>
> count = 3
> def foo():
>     print var('count', 1)
> foo()
>
> If the output is "1", then you're in luck and can already use
> vars().get('count', 1)
>
> Otherwise, I don't know a trivial one-liner to do it. Either way I'd
> be -1 on its inclusion in Python, it encourages a bad idiom.
>
> -- Devin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140102/944ecedb/attachment.html>


More information about the Python-ideas mailing list