two ideoms at one blow: line-reading and regexp-matching

Paul Rubin phr-n2002a at nightsong.com
Thu Feb 21 13:28:36 EST 2002


Gustavo Cordova <gcordova at hebmex.com> writes:
> > Anyway, =/== is a dead horse--didn't we agree that using := for assigments
> > in expressions totally fixes it?  So there's no reason to keep coming
> > back to it.
> > 
> 
> Er, no, we didn't :-)
> 
> _YOU_ and _I_ agreed that it's more readable and less
> error prone than simply using "=" in an expression.
> That's it. Don't include me in your revolution.

Yes, by "we" I meant you and I.  So in your opinion, does := fix the =/==
problem or not?

> > If you want Python to catch more typos for you,
> > you're better off asking for Python to check for
> > variable declarations (I don't mean static types,
> > I just mean "local x") and flag undeclared variables
> > like you can with perl's "use strict" option.
> > That will prevent a lot more bugs than := is likely to cause.
> > 
> 
> Now this is just plain nasty.

It's not intended as nasty.  Misspelled variable names are a source of
bugs in Python programs, to a great extent than in languages where you
have to declare variables.

> > And it fills more space on the screen, ...
> 
> So, get a larger monitor, or use a smaller font, or make the editor
> window larger, or change your text mode (if using text mode), or ...

That reaches a limit and then you can't do it any more.


> > > But in the end, neither of our subjective opinions
> > > matter - Guido's does. That's probably why this
> > > language is so great.
> > 
> > Guido doesn't write our code; we do.
> 
> That's all nice and useful. I'm not defending Guido, but hey, let's
> keep this civil, ok?

I'm not attacking Guido.  I believe Guido set out to design a language
that could easily be used by a wide range of different programmers.
If instead he'd set out to design a language that mapped onto his own
particular thought structures (which is what Larry Wall set out to
do), he'd have probably gotten a much more idiosyncratic language,
like perl, but different.  Since nobody can predict perfectly how
other programmers are going to react to things, their reports of their
experiences are an important source of data.

> *If* it weren't for Guido, we/you wouldn't *have* Python to hack on.

What are you getting at?  I'm not attacking Guido.

> Second, Guido's a pretty smart person. So maybe
> he did give quite a bit of thought about the
> expression/asignment thing.

He gave thought to augmented assignments too, and decided not to put
them into Python 1.x.  Then it turned out that a lot of people wanted
them, so they went into 2.0.

> "Language" is the expression of a person's thoughts, and thoughts
> and ideas expressed in a Language tend to reflect the structure of
> that persons thoughts.
> 
> On the other hand, the inverse process also happens: "Language"
> tends to impose, with time, it's structure and semantics upon it's
> users mind. Like a kind of feedback. The Object modifying the
> Observer.

That theory was popular in linguistics (type "Sapir-Whorf hypothesis"
into Google) for a while, but was eventually discredited and is now
considered bogus, at least at the lowest fundamental level.

> One thing which is quite delightful about Python is it's
> high-quality, simple-to-use, and quite powerful, included
> library. Even if lots of modules have "amateur" origins, it's of
> very high quality, and usability.

Sure, but there's always room for improvement.

> So. If the Language (Python) changes, in a way that it doesn't
> impose a Neat, Orderly, Clean, programming style, then I really
> believe that the Language will --passively-- encourage sloppy code.

I don't see your idiomatic 6-line while loop as being neater or
more orderly as the straightforward 2-line version that uses :=
in the control expression.

> Thursday!!

One day to TGIF?



More information about the Python-list mailing list