PEP 3107 and stronger typing (note: probably a newbie question)

Steve Holden steve at holdenweb.com
Wed Jul 11 21:30:35 EDT 2007


Donn Cave wrote:
> In article <mailman.457.1183941294.22759.python-list at python.org>,
>  Steve Holden <steve at holdenweb.com> wrote:
> 
>> Paul Rubin wrote:
>>> Steven D'Aprano <steve at REMOVE.THIS.cybersource.com.au> writes:
>>>> As far as I can see, the only difference is that the list comp variable
>>>> isn't explicitly created with a statement of the form "name = value". Why
>>>> is that a problem?
>>> I don't know that listcomp vars are worse problem than other vars;
>>> however there is an easy workaround for the listcomp vars so I use it.
>>> If there was a way to restrict the scope of other local vars (I gave
>>> examples from other languages of how this can be done), I'd use that too.
> 
> Someday we will look at "variables" like we look at goto.
> 
How very functional. I believe some people naturally think in terms of 
state transformations and some in terms of functional evaluation.  I am 
pretty firmly in the former camp myself, so variables are a natural 
repository for state to me.

>> Maybe we just have different styles, and I naturally tend to write in 
>> smaller scopes than you do.
> 
> I've wondered if programmers might differ a lot in how much they
> dread errors, or how they react to different kinds of errors.
> For example, do you feel a pang of remorse when your program
> dies with a traceback - I mean, what a horrible way to die?
> Do you resent the compiler's reprimands about your code errors,
> or nagging about warnings?  Maybe the language implementation's
> job has as much to do with working around our feelings as anything
> else.
> 
That's an interesting point of view. I certainly don't take the somewhat 
anthropomorphic approach you describe above. My first response to any 
"error" message is to ask myself "what did I do wrong *now*?" - the very 
fact that we talk about "error messages" implies a point of view that's 
discouraging to new users: "you did something wrong, fix it and try again".

I do think that most language implementations could spend more time, and 
more sympathetic thought, on creating messages that were less pejorative 
and more indicative of the required corrective actions. But after forty 
years programming I know myself well enough to understand that I am the 
most likely cause of incorrect results.

It's always amusing to see a newbie appear on this list and suggest that 
there's a bug in some long-standing feature of the language. It's always 
a possibility, but the probability is pretty low.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------




More information about the Python-list mailing list