Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81836

Re: Python handles globals badly.

Path csiph.com!usenet.pasdenom.info!news.franciliens.net!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python.': 0.02; 'explicitly': 0.05; 'newbie': 0.05; 'subject:Python': 0.06; 'test,': 0.07; 'variables': 0.07; 'ide': 0.09; 'large-scale': 0.09; 'objects,': 0.09; 'scripting': 0.09; 'statements': 0.09; 'works.': 0.09; 'python': 0.11; 'language,': 0.12; 'suggest': 0.14; '(just': 0.16; 'attributes,': 0.16; 'before.': 0.16; 'callable': 0.16; 'change;': 0.16; 'dictionaries': 0.16; 'did,': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'grasp': 0.16; 'implies': 0.16; 'language)': 0.16; 'mutable': 0.16; 'object),': 0.16; 'rebound': 0.16; 'language': 0.16; 'wrote:': 0.18; 'module': 0.19; 'trying': 0.19; 'programming': 0.22; 'header:User-Agent:1': 0.23; '(such': 0.24; 'rapidly': 0.24; "haven't": 0.24; '(or': 0.24; "i've": 0.25; 'mention': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'feature': 0.29; "doesn't": 0.30; 'forgot': 0.30; "i'm": 0.30; 'code': 0.31; 'easier': 0.31; 'fighting': 0.31; 'flying': 0.31; 'lot.': 0.31; 'pascal': 0.31; 'allows': 0.31; 'file': 0.32; 'class': 0.32; 'languages': 0.32; 'open': 0.33; 'are:': 0.33; "i'd": 0.34; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'really': 0.36; 'date.': 0.36; 'keyword': 0.36; 'leads': 0.36; 'programming,': 0.36; 'scheme': 0.36; 'surely': 0.36; 'done': 0.36; 'method': 0.36; 'possible': 0.36; 'application': 0.37; 'being': 0.38; 'message-id:@gmail.com': 0.38; 'ends': 0.38; 'form,': 0.38; 'needed': 0.38; 'to:addr:python- list': 0.38; 'files': 0.38; 'pm,': 0.38; 'little': 0.38; 'anything': 0.39; 'does': 0.39; 'functional': 0.39; 'heard': 0.39; 'structure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'even': 0.60; 'tell': 0.60; 'new': 0.61; 'simple': 0.61; "you're": 0.61; 'first': 0.61; "you'll": 0.62; "you've": 0.63; 'address': 0.63; 'name': 0.63; 'more': 0.64; 'frustrated': 0.68; 'opinions': 0.70; 'friendly': 0.72; 'to,': 0.72; 'miss': 0.74; 'funny': 0.74; 'eyes': 0.78; 'you:': 0.81; 'bot': 0.84; 'delphi': 0.84; 'delphi,': 0.84; 'dispatching': 0.84; 'expressive': 0.84; 'goto': 0.84; 'horrible': 0.84; 'how.': 0.84; 'miss.': 0.84; 'boxes': 0.91; 'procedural': 0.91; 'wish,': 0.91
X-Virus-Scanned amavisd-new at torriefamily.org
Date Tue, 02 Dec 2014 22:23:29 -0700
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11
MIME-Version 1.0
To python-list@python.org
Subject Re: Python handles globals badly.
References <c3363$547e74fe$5419aafe$24179@news.ziggo.nl> <mailman.16509.1417576416.18130.python-list@python.org> <b257d$547e9225$5419aafe$17940@news.ziggo.nl>
In-Reply-To <b257d$547e9225$5419aafe$17940@news.ziggo.nl>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16516.1417584217.18130.python-list@python.org> (permalink)
Lines 64
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417584218 news.xs4all.nl 2930 [2001:888:2000:d::a6]:38603
X-Complaints-To abuse@xs4all.nl
X-Received-Body-CRC 3763808325
X-Received-Bytes 7368
Xref csiph.com comp.lang.python:81836

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Python handles globals badly. "Skybuck Flying" <skybuck2000@hotmail.com> - 2014-12-03 03:27 +0100
  Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2014-12-03 13:35 +1100
  RE: Python handles globals badly. "Clayton Kirkwood" <crk@godblessthe.us> - 2014-12-02 18:53 -0800
  Re: Python handles globals badly. Michael Torrie <torriem@gmail.com> - 2014-12-02 20:13 -0700
    Re: Python handles globals badly. "Skybuck Flying" <skybuck2000@hotmail.com> - 2014-12-03 05:32 +0100
      Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2014-12-03 15:42 +1100
      Re: Python handles globals badly. Dave Angel <davea@davea.name> - 2014-12-03 00:02 -0500
      Re: Python handles globals badly. Michael Torrie <torriem@gmail.com> - 2014-12-02 22:23 -0700
        Re: Python handles globals badly. Marko Rauhamaa <marko@pacujo.net> - 2014-12-03 08:52 +0200
          Re: Python handles globals badly. Joel Goldstick <joel.goldstick@gmail.com> - 2014-12-03 02:17 -0500
      Re: Python handles globals badly. Joshua Landau <joshua@landau.ws> - 2014-12-03 13:07 +0000
      Re: Python handles globals badly. mm0fmf <none@mailinator.com> - 2014-12-03 18:04 +0000
        Re: Python handles globals badly. sohcahtoa82@gmail.com - 2014-12-03 10:16 -0800
          Re: Python handles globals badly. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-04 11:57 +1100
            Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2014-12-04 12:10 +1100
            Re: Python handles globals badly. Joel Goldstick <joel.goldstick@gmail.com> - 2014-12-03 20:23 -0500
          Re: Python handles globals badly. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-12-03 22:57 -0500
          Re: Python handles globals badly. Michael Torrie <torriem@gmail.com> - 2014-12-03 21:11 -0700
  Re: Python handles globals badly. Ben Finney <ben+python@benfinney.id.au> - 2014-12-03 14:21 +1100
  Re: Python handles globals badly. "Skybuck Flying" <skybuck2000@hotmail.com> - 2014-12-03 05:17 +0100
    Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2014-12-03 15:36 +1100
    Re: Python handles globals badly. Tony the Tiger <tony@tiger.invalid> - 2014-12-04 20:27 +0000
  Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-12-03 12:35 +0000
    Re: Python handles globals badly. "Skybuck Flying" <skybuck2000@hotmail.com> - 2014-12-04 00:02 +0100
      Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-12-04 01:32 +0000
      Re: Python handles globals badly. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-12-03 23:01 -0500
      Re: Python handles globals badly. jtan <admin@grails.asia> - 2014-12-04 13:03 +0800
        Re: Python handles globals badly. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-04 22:35 +1100
          Re: Python handles globals badly. jtan <admin@grails.asia> - 2014-12-04 22:38 +0800
      Re: Python handles globals badly. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-12-04 10:24 +0000
      Re: Python handles globals badly. Chris Angelico <rosuav@gmail.com> - 2014-12-04 21:29 +1100
        Re: Python handles globals badly. Marko Rauhamaa <marko@pacujo.net> - 2014-12-04 14:51 +0200
          Re: Python handles globals badly. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-12-04 20:56 -0500
          Re: Python handles globals badly. William Ray Wing <wrw@mac.com> - 2014-12-04 23:17 -0500
      Re: Python handles globals badly. alister <alister.nospam.ware@ntlworld.com> - 2014-12-04 19:54 +0000
  Re: Python handles globals badly. Peter Pearson <pkpearson@nowhere.invalid> - 2014-12-03 20:31 +0000

csiph-web