Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81834
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'languages.': 0.04; 'that?': 0.05; 'subject:Python': 0.06; 'attribute': 0.07; 'variables': 0.07; 'feature,': 0.09; 'ide': 0.09; 'python': 0.11; 'def': 0.12; 'language,': 0.12; 'suggest': 0.14; 'wrote': 0.14; 'anyway': 0.14; 'language.': 0.14; 'mostly': 0.14; '11:32': 0.16; 'attributes.': 0.16; 'crude': 0.16; 'declarations': 0.16; 'dict': 0.16; 'dump': 0.16; 'forbids': 0.16; 'forth.': 0.16; 'implies': 0.16; 'investigate': 0.16; 'local.': 0.16; 'modules.': 0.16; 'objects.': 0.16; 'flexibility': 0.16; 'all.': 0.16; 'so.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'module': 0.19; 'skip:g 40': 0.19; 'things.': 0.19; 'typing': 0.19; 'help.': 0.21; 'code,': 0.22; 'example': 0.22; 'programming': 0.22; 'comfortable': 0.22; 'header:User-Agent:1': 0.23; 'example.': 0.24; 'library,': 0.24; 'skip:l 30': 0.24; "haven't": 0.24; 'second': 0.26; 'pass': 0.26; 'asking': 0.27; 'certain': 0.27; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'feature': 0.29; "doesn't": 0.30; 'skip:g 30': 0.30; 'statement': 0.30; 'code': 0.31; 'easier': 0.31; 'breaking': 0.31; 'flying': 0.31; 'forces': 0.31; 'styles': 0.31; 'class': 0.32; 'probably': 0.32; 'entirely': 0.33; 'programmers': 0.33; '"the': 0.34; "i'd": 0.34; 'could': 0.34; 'classes': 0.35; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'doubt': 0.36; 'functions.': 0.36; 'impression': 0.36; 'keyword': 0.36; 'leads': 0.36; 'object,': 0.36; 'processed': 0.36; 'next': 0.36; 'should': 0.36; 'seconds': 0.37; 'too': 0.37; 'list': 0.37; 'somebody': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'short': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'how': 0.40; 'even': 0.60; 'read': 0.60; 'easy': 0.60; 'hope': 0.61; 'utilize': 0.61; 'new': 0.61; 'simple': 0.61; "you're": 0.61; 'first': 0.61; 'address': 0.63; 'information': 0.63; 'skip:n 10': 0.64; 'became': 0.64; 'networking': 0.64; 'more': 0.64; 'different': 0.65; 'within': 0.65; 'received:74.208': 0.68; 'funny': 0.74; 'as:': 0.81; 'you:': 0.81; 'benchmark': 0.84; 'delphi,': 0.84; 'etc..': 0.84; 'mature': 0.84; 'received:74.208.4.194': 0.84; 'thing...': 0.84 |
| Date | Wed, 03 Dec 2014 00:02:20 -0500 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
| 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; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:b6hBQK8moZUPmVv8ps7wtCMQ0VD/CY/80nl7D2w/P1v 3n7E1kuFS0RRcY96kHWdafZMhb7PCgj4BXNPfhuWzK47h7PyRk vXgXMTnrK0wznFsGvEjjVGUM5h4/iMD8sUsTIVCw5sHLCuYwyA NkUJ6BMTqS7Y9glq7Tzrfev6p/zyY5CGuXCJG7I/o/Ay8ryDSN COGUG594c2YQpZoxx15UWQPW52c+Kcb2zZeZ9ao6IuxtZnfgTZ SDTxeKWWI4QTdg9hQ7BYhfrgKmyypS8CEa5ArW7ub+wKY9xHYS eokNhZvKrgd2IL2kK1cEaQZ7NZ0AwEzIgutAOZ3ARkxoAR+oQM 2LV2c68Py2O1I/rEXqaM= |
| X-UI-Out-Filterresults | notjunk:1; |
| 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.16514.1417582963.18130.python-list@python.org> (permalink) |
| Lines | 103 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1417582963 news.xs4all.nl 2871 [2001:888:2000:d::a6]:33149 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81834 |
Show key headers only | View raw
On 12/02/2014 11: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.
>
> I used the list feature of python to dump these variable in a list so
> that all variables can be processed by a while loop and so forth.
Care to share what you mean by "the list feature"? Perhaps you'd do
better with "the dict feature", or "the attribute feature."
>
> At first I wanted flexibility and all variables were individually
> "logic-ed" / "processed" but this became too much code to work with.
>
No meaning without an example.
> I was also under the impression using many ifs might be faster than
> lists, but this was bogus information at best.
They do entirely different things. Without example code, this statement
is also meaningless to me.
>
> I wrote a simple short benchmark for if vs list and list performed fast
> enough for my purposes, it could both handle 500k of items without
> breaking a sweat, meaning within 1 to 3 seconds or so.
>
> I am still new at python and definetly don't feel comfortable with the
> object feature, though I did use it for these variables which are
> actually objects.
Everything in Python is an object, from ints to functions. That makes
lots of things easier and more symmetric.
>
> I used to program in Delphi, there I would do everything OO and modular.
So why do you no longer want to do that?
>
> 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.
So don't use modules. Nothing about the language forces you to. The
main time you might need modules is when you write your second program.
Of course, it's nice that somebody else wrote lots of modules for you,
the standard library, and PIPI.
>
> Python also comes with nice libaries/lists/dictionaries/file io etc..
> all easy to use...
>
> I haven't tried networking with python yet... that could be funny to try
> next for my bots :)
>
> Anyway this global thing made my doubt if python is a good thing... all
> in all it wasn't too bad...
>
You still haven't figured out that declaring the occasional global is
much less typing than declaring every local. If you're writing code
that's mostly using globals, you probably should investigate the tens of
thousands of other languages.
> Though I do hope to see a programming language some day, that is aimed
> at more mature programmers that know what they are doing.
>
> Instead of a language aimed at noobs :) a noob language which forbids
> certain styles of programming because it would be "bad".
That's ridiculous. Python is far from a "noob" language. But when
you're a noob, and can still get things accomplished, that's a good
thing. Then when you're ready to learn more about the language, asking
non-confrontational questions might get you some help.
I suggest you learn enough about classes to understand how to make and
utilize an object with arbitrary attributes. Even if you did something
as crude as:
class Dummy(object):
pass
global = Dummy()
global.ShipAbilityDistributeShieldPower = 42
global.ShipAbilityTargetWeaponsSubsystems = 12
...
You can then read and write those values inside functions with no global
declarations at all.
def myfunc():
if something:
global.ShipAbilityDistributeShieldPower = 2
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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