Proposal for new minor syntax

Rustom Mody rustompmody at gmail.com
Sat Mar 28 00:18:29 EDT 2015


On Saturday, March 28, 2015 at 6:26:26 AM UTC+5:30, Ian wrote:
> On Fri, Mar 27, 2015 at 6:33 PM, Mario Figueiredo  wrote:
> > On Sat, 28 Mar 2015 10:39:04 +1100, Ben Finney wrote:
> >
> >>Jamie Willis writes:
> >>
> >>> This could be written as:
> >>>
> >>> hello = "hello world              "
> >>> hello .= strip()
> >>
> >>?1, ".=" is visually too similar to "=".
> >
> > can't be much worse than
> >
> >     hello = "hello world    ",
> >
> > I think the dot next to the equal sign makes it very distinctive. The
> > equal sign is something we are so visually used to that any small
> > deviation gets immediately recognized by our brain. I may be wrong on
> > this assumption...
> 
> It depends somewhat on context. In the variable-width font that I'm
> reading my email in, the dot looks like a single pixel and doesn't
> create much visual spacing either. It would be very easy to miss. In a
> terminal window with Courier New on the other hand, it does look
> distinctive enough to be noticeable.  We should keep in mind though
> that our code isn't always going to be read in Courier New.

Dunno if related...
One thing that is a bit laborious in python are object initializers:

  self.attr1 = field1
  self.attr2 = field2

In VB one can do:

  with self
    .attr1 = field1
    .attr2 = field2

(or something like that -- dont exactly remember the syntax)




More information about the Python-list mailing list