Double sided double underscored variable names

Joshua Landau joshua.landau.ws at gmail.com
Tue Sep 11 21:38:09 EDT 2012


On 12 September 2012 02:14, Steven D'Aprano <
steve+comp.lang.python at pearwood.info> wrote:

> And again, Joshua's original post is not available from my provider.
> Joshua, I suspect that something about your post is being seen as spam
> and dropped by at least some providers.
>

I am sorry to ask this, but in the meantime can someone who isn't
spam-filtered repost my messages? I'll give them a cookie!
To repeat my previous post, I'm using GMail and posting to
python-list at python.org. If that is what I'm meant to be doing, I'll try
another email address.


> On Wed, 12 Sep 2012 08:52:10 +1000, Chris Angelico wrote:
>
> > On Wed, Sep 12, 2012 at 8:48 AM, Joshua Landau
> > <joshua.landau.ws at gmail.com> wrote:
> >>
> >> Well, the problem is that a lot of collisions aren't predictable.
> >> "locals()['foo'] = 2", for example. If it weren't for Python's annoying
> >> flexibility*
>
> I can't see your footnote there, so you may have already covered this,
> but for the record, what you call Python's "annoying flexibility" is
> fundamental to Python's programming model and done so for good reasons.
> The ability to shadow built-ins is, at times, incredibly useful rather
> than annoying.
>
> The world is full of bondage and domination languages that strongly
> restrict what you can do. Python doesn't need to be another one of them.
> Python's optimizing compiler, PyPy, is able to optimize code very well
> without such restrictions.


I agree :P. The footnote should portray that I said that in jest.


>  >> I would definitely do something very close to what you
> >> suggest. Remember that "locals()" isn't Python's only introspection
> >> tool. How about "from foo import *"?
>
> I wouldn't call "import *" an introspection tool. At least, no more so
> than print.


Yeah, I meant "things that can change the current scope without explicitly
naming the changes". "print" doesn't do that, but you are correct in what
you say.

<snip>

> but I suppose globals() works the same way.
> >
> > Inline functions? I like this idea. I tend to want them in pretty much
> > any language I write in.
>
> What do you mean by in-line functions? If you mean what you literally
> say, I would answer that Python has that with lambda.
>
> But I guess you probably mean something more like macros.


No, just multi-line lambda. Macros, if my knowledge of lower-level
languages is valid, would be sorta' silly in Python.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120912/0ce084dc/attachment.html>


More information about the Python-list mailing list