Python handles globals badly.

Michael Torrie torriem at gmail.com
Wed Dec 3 00:23:29 EST 2014


On 12/02/2014 09:32 PM, Skybuck Flying wrote:
> Some issues I'd like to address to you:
> 
> 1. Structured programming requires more programming time.
> 2. Structured programming implies structure which might be less flexible.
> 3. Python objects require "self" keyword to be used everywhere, and other 
> akwardness wich leads to more typing/programming/writing time.

You forgot to mention that horrible white-space being syntax! Surely
that is inflexible and awkward!

> I used to program in Delphi, there I would do everything OO and modular.

Python allows you to explicitly use an OO paradigm if you wish, or use a
more procedural form, or functional form (to a degree anyway).  All the
while using and exploiting object-oriented characteristics (modules,
attributes, etc) throughout.  It's really the best of both worlds.

> Lastly I also don't like the module approach in python because the sikuli 
> ide doesn't really support working with multiple files that well.

A poor craftsman blames his tools for his own shortcomings.  I suggest
you change tools to something a little more flexible (just about
anything really)

> Even if it did, having all code in one big file is a pretty big adventage.

Not really.  Keeping things as simple as possible and modular is easier
to debug, easier to test, add features to, and easier to understand
three months from now.  I can tell by your opinions that you've never
done any medium to large-scale development before.

> So features I miss in python are: "labels" "goto statements" and "repeat 
> until".

Python is newbie friendly (mostly), but it is a far, far more powerful,
capable, and expressive language than Delphi ever was.  Take a theory of
computer languages class some time (create your own language even...
Scheme is a good place to start).  It might open your eyes a lot.
Python is not just a scripting language, it's a powerful application
development language that allows me to create code rapidly that actually
works.  I'm far more productive in Python than in any language I've used
to date.

> 
> Funny thing is these goto statements would be very handy for bot 
> programming, so it's a painfull feature to miss.

Haven't heard that argued in many years.  And I don't see how.  Python
has very powerful ways of dispatching execution including dictionaries
of functions, callable objects, etc.  Sounds like you're programming in
a very primitive way, reinventing many structures that Python already
has.  I know that some low-level C programming does rely on and use
goto, but in Python I've never needed it.

You're not the first person to not grasp Python fundamentals (such as
how variables work with name binding vs the Delphi idea of named boxes
that can actually be change; python variables can only be rebound to new
objects, unless you call a method on a mutable object), who ends up
fighting the language and being really frustrated with it.  Sounds like
you're trying to code Pascal (or some other language) in Python.  This
is going to be frustrating.  I suggest you learn what it means to code
in a "Pythonic" way and you'll find you are really productive and having
a lot of fun.



More information about the Python-list mailing list