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


Groups > comp.lang.python > #86594

Re: Python Worst Practices

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3.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.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'win32': 0.03; 'languages,': 0.04; 'syntax': 0.04; 'warnings': 0.04; 'subject:Python': 0.06; '(especially': 0.07; 'abuse': 0.07; 'c++,': 0.07; 'column': 0.07; 'context': 0.07; 'duplicate': 0.07; 'list?': 0.07; 'practice,': 0.07; 'bytes,': 0.09; 'explanation': 0.09; 'i\xe2\x80\x99ve': 0.09; 'lawrence': 0.09; 'python': 0.11; 'stored': 0.12; "wouldn't": 0.14; 'windows': 0.15; 'bind': 0.16; 'debugged': 0.16; 'defined.': 0.16; 'holy': 0.16; 'i\xe2\x80\x99d': 0.16; 'renamed': 0.16; 'shalt': 0.16; 'stages,': 0.16; 'travis': 0.16; 'uh,': 0.16; 'worst': 0.16; 'language': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'things.': 0.19; 'examples': 0.20; 'feb': 0.22; 'load': 0.23; 'header:User-Agent:1': 0.23; 'error': 0.23; 'bytes': 0.24; 'dll': 0.24; 'header': 0.24; '(or': 0.24; 'mention': 0.26; 'right.': 0.26; 'header:In-Reply-To:1': 0.27; 'words': 0.29; 'especially': 0.30; '25,': 0.31; 'constant': 0.31; 'directory,': 0.31; 'file': 0.32; 'figure': 0.32; 'run': 0.32; 'linux': 0.33; 'programmers': 0.33; 'noticed': 0.34; 'agree': 0.35; 'common': 0.35; 'convert': 0.35; 'late': 0.35; 'one,': 0.35; 'but': 0.35; 'object,': 0.36; 'should': 0.36; 'being': 0.38; 'others.': 0.38; 'requiring': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'expect': 0.39; 'bad': 0.39; 'itself': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'changed': 0.39; 'enough': 0.39; 'skip:p 20': 0.39; 'called': 0.40; 'how': 0.40; 'read': 0.60; 'course.': 0.60; 'liked': 0.60; 'most': 0.60; 'first': 0.61; 'times': 0.62; 'making': 0.63; 'more': 0.64; 'forward': 0.65; '(that': 0.65; 'between': 0.67; 'received:74.208': 0.68; 'gotten': 0.74; 'obvious': 0.74; 'can\xe2\x80\x99t': 0.84; 'conflicts': 0.84; 'confusing': 0.84; "it'd": 0.84; 'subject:Practices': 0.84; 'visits': 0.84; 'conflicts,': 0.91; 'good,': 0.91; 'mistake': 0.91; 'notorious': 0.91; 'you\xe2\x80\x99re': 0.91
Date Fri, 27 Feb 2015 16:37:17 -0500
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Python Worst Practices
References <mclca6$iie$1@ger.gmane.org> <7053A277-9687-49B0-9FDB-CB4DB3E76DEC@gmail.com>
In-Reply-To <7053A277-9687-49B0-9FDB-CB4DB3E76DEC@gmail.com>
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
X-Provags-ID V02:K0:TfDxeKnfBPIXdMNOJFUlQUlLkLh2q4oxDE79pmOyFQM qMcTG2OevURB5tN/t5xvWY2aNOQg3kgewNvaQsapkFcu87JPEH g/cVJmsGqL6bPqKP5DDyRO8eYJv+MSclDd2S3BlJGeYtGaPtgH 9MxB4BjVIyg1zVVT/pFNptQ+mKJ9YP+ED3TXN+nop44SjUpkHN MCrwKzBmcIyqRilkavG/DV1NDXaayxytXJ0kLt2L0rPOe92/HX kfgDDB2u71OJC5lLbyw1Gy+HzQAO1k885oenFnm3NUZijP17XF tvkH23qVJNCDMX2zRHThn5ehmxIuCfthBPLnjRXw8loczTYBsY g4v/C7hKFQ4S6eFbZURY=
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.19320.1425073044.18130.python-list@python.org> (permalink)
Lines 47
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1425073044 news.xs4all.nl 2907 [2001:888:2000:d::a6]:34435
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:86594

Show key headers only | View raw


On 02/27/2015 04:21 PM, Travis Griggs wrote:
>
>> On Feb 25, 2015, at 12:45 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>>
>> http://www.slideshare.net/pydanny/python-worst-practices
>>
>> Any that should be added to this list?  Any that be removed as not that bad?
>
> I read ‘em. I thought they were pretty good, some more than others. And I learned some things. I especially liked the first one, since I’ve struggled with that one a bunch. In the context of “hey, accept Python for what it is”, I agree greatly with it. Memorize the builtins, and stay the heck away from them. I’ve been burned many times because I stored some bytes in a binding call, er, uh, ‘bytes’. And having mentored some people learning Python in the early stages, any explanation other than “Thou Shalt Never Use These Holy Words” just confuses people.
>
> That said…
>
> If I were giving a talk at SPLASH (or some other suitable polyglot conference), I might do one called “Language Design Worst Practices”.
>
> One of my first slides might be titled:
>
> Abuse Common Tokens in Confusing Ways
>
> * Make your language have a lot of keywords. Enough to make memorizing them ALL unlikely, requiring constant visits to your documentation
> * Make sure said keywords are many of the obvious words programmers would use in their applications (map, object, bytes, dir, etc)
> * Design your syntax so that you can’t disambiguate them contextually between bind and reference
> * Be sure to use it in a late bound language where no warnings will be provided about the mistake you’re making at authorship time, deferring the educational experience to sundry run times
>
> In my examples column of this bad practice, I’d put Python of course. :)
>
> I do like Python, and I accept it for what it is, so no one needs to jump forward as a Holy Python See to convert me to the truth. I also know that with most other languages, that first slide wouldn’t need to be one of the prominent “worst practices” slide.
>

Right.  In C and C++, instead of being the first slide, it'd be the 
first 3 or 4.  Between header file conflicts (especially good because 
the stdlib itself has many multiply-defined symbols, duplicate header 
files, and contradictory include path patterns), implib conflicts, and 
DLL load conflicts, not to mention the notorious win32 directory, which 
is magically renamed out from under you in 64bit code.  (That one is a 
Windows thing;  I wouldn't expect that Linux got caught in that trap)

I don't know how much of this has changed in recent years, but I suspect 
it's gotten much worse, not better.

In Python, the error is noticed much later, but it can actually be 
debugged without tearing out one's hair.  Things like
     print(mymodule.__file__)

to figure out where the mymodule is defined.

-- 
DaveA

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


Thread

Re: Python Worst Practices Dave Angel <davea@davea.name> - 2015-02-27 16:37 -0500

csiph-web