Feature request: String-inferred names

inhahe inhahe at gmail.com
Sat Nov 28 23:06:15 EST 2009


i like this idea (i posted some thoughts on it in the blog, but it's not
approved yet as of this writing)

in short, i suggested extending the idea to make it more a) generalized, b)
simple, c) intuitive, and d) flexible.

so instead of just using $ for attributes, you could use it anywhere you
define or reference a name.

as in..

class $a: pass

or

$a = 1

also, you might want to do something like this
b = ["zero", "one"]

$b[0] = 0

but that's ambiguous, so you need some sort of grouping mechanism
like for example

${b[0]} = 0

although "$(b[0]) = 0" might be just as reasonable.

also maybe:

b = 'bar'

foo$b = 'baz'
print foobar
#prints baz

${b}foo = 'baz'
print barfoo
#prints baz

$foo{b}baz = 1
print foobarbaz
#prints 1

but i know that last idea is getting way into php-land and probably isn't
(quote-unquote) necessary.


i know a lot of people would probably hate this idea with a passion.  i tend
to be more liberal when it comes to adding concision and dynamicism in a
language, although that could be just because it's too tempting; i.e., maybe
it's only because somebody drew a line somewhere that we're coding in Python
instead of K.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091128/6d81844b/attachment.html>


More information about the Python-list mailing list