[Python-ideas] Mitigating 'self.' Method Pollution

David Mertz mertz at gnosis.cx
Sat Jul 11 17:39:59 CEST 2015


On Jul 11, 2015 1:40 AM, "Nick Coghlan" <ncoghlan at gmail.com> wrote:
> Alternative proposal:
>
>     def keep_moving_gravity(self):
>         .y += .gravity
>         .y = max(.y, 0)
>         .y = min(.y, height - 1)

Assuming the parser could be made to handle this (which feels like a big
stipulation), this variation would deal with the non-explicit dynamic
scoping bug magnets.

It might violate the "looks like grit on Tim's screen" principle, but it is
explicit.  I'd only be -0 or -0.5 on this idea.

Since we have Unicode though, how about:

    •y += •gravity

Or

    ∆y += ∆gravity

Guaranteed no parser ambiguity, and some symbols are bigger than grit. In
fact, maybe we could get the Unicode Consortium to add a glyph that looked
like 'self.' To make it stand out even better.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150711/2239b4ca/attachment.html>


More information about the Python-ideas mailing list