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


Groups > comp.lang.python > #104473

Re: A mistake which almost went me mad

Newsgroups comp.lang.python
Date 2016-03-09 22:13 -0800
References <56d81044$0$19756$426a74cc@news.free.fr> <67f3f258-88e7-4fb5-97f4-f0b1ae63e09c@googlegroups.com>
Message-ID <fadbcdc0-4754-4f1f-85d6-c940a74675bc@googlegroups.com> (permalink)
Subject Re: A mistake which almost went me mad
From Rustom Mody <rustompmody@gmail.com>

Show all headers | View raw


On Wednesday, March 9, 2016 at 10:04:35 PM UTC+5:30, Rick Johnson wrote:
> On Thursday, March 3, 2016 at 4:22:07 AM UTC-6, ast wrote:
> > Hello
> > 
> > This has to be told
> > 
> > I created a file pickle.py in order to test some files
> > read/write with objects and put it in a directory
> > which is on my python path. 
> > 
> > Then the nightmare began
> > 
> > - Idle no longer works, window no longer opens 
> > when double clicked, no errors messsages
> > 
> > - python -m pip list doesnt work, crash with an 
> > error message related to pickle
> > 
> > I uninstalled python34 and reinstalled it, same problem
> > I uninstalled python34 and instaled 3.5, same problem
> > 
> > ...
> > 
> > I finally understood that pickle.py is the name of the file
> > containing the official pickle module.
> > 
> > This module is probably used by various python programs,
> > IDLE, pip ...
> > 
> > Instead of reading official pickle, python read my file ...
> 
> This is a design flaw of the python language. If all standard library modules would have been protected from the global namespace by a single symbol -- say "stdlib" or "py" or whatever -- we would only need to avoid *ONE* symbol, instead of hundreds of them!!! Third party modules should have their own namespace as well. 
> 
>  from stdlib import re
>  from stdlib.re import search
>  from extlib import PIL
>  from extlib.PIL import Image, ImageTk
> 
> Since those responsible for this flaw are unable, or unwilling, to fix it, the only solution for *YOU* is to (1) memorize every module name that exists in the python standard library, and also those that exist in your "site-packages" directory, or (2) hide all your personal modules behind a single symbol by utilizing a package.
>  
>  +mylib
>    __init__.py
>    pickle.py
> 
> import mylib.pickle as mypickle
> mypickle.do_something()

As usual Rick I find myself agreeing with your direction [also it seems
Random832's direction] though not with the ranty tone.

Ive been collecting factoids about how programming pedagogy and professional
programming practice cannot be conflated under one roof

[See http://blog.languager.org/2015/06/functional-programming-moving-target.html ]

One argument against that is -- in some guise or other -- to use namespaces.
eg If you dont need a language-feature dont use it
  If you dont need a library dont use it

These arguments neglect that the namespacing -- semantics, intricacies, headaches, etc -- ITSELF may be significantly noob-unfriendly.

For cars one needs: 
- the hood securely fastened when teaching driving
- easily openable when teaching automobile engineering

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


Thread

A mistake which almost went me mad "ast" <nomail@invalid.com> - 2016-03-03 11:21 +0100
  Re: A mistake which almost went me mad Chris Angelico <rosuav@gmail.com> - 2016-03-03 21:31 +1100
  Re: A mistake which almost went me mad Nick Sarbicki <nick.a.sarbicki@gmail.com> - 2016-03-03 10:43 +0000
  Re: A mistake which almost went me mad Tim Golden <mail@timgolden.me.uk> - 2016-03-03 10:48 +0000
    Re: A mistake which almost went me mad Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-03-04 19:19 +1300
  Re: A mistake which almost went me mad Steven D'Aprano <steve@pearwood.info> - 2016-03-03 23:57 +1100
  Re: A mistake which almost went me mad Tim Chase <python.list@tim.thechases.com> - 2016-03-03 05:48 -0600
  Re: A mistake which almost went me mad Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-03-03 16:29 +0000
    Re: A mistake which almost went me mad Rob Gaddi <rgaddi@highlandtechnology.invalid> - 2016-03-03 17:53 +0000
  Re: A mistake which almost went me mad Tim Chase <python.list@tim.thechases.com> - 2016-03-03 12:50 -0600
  Re: A mistake which almost went me mad Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-07 09:19 -0700
  Re: A mistake which almost went me mad Random832 <random832@fastmail.com> - 2016-03-07 11:28 -0500
  Re: A mistake which almost went me mad Chris Angelico <rosuav@gmail.com> - 2016-03-08 03:40 +1100
  Re: A mistake which almost went me mad Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-09 08:34 -0800
    Re: A mistake which almost went me mad Rustom Mody <rustompmody@gmail.com> - 2016-03-09 22:13 -0800
      Re: A mistake which almost went me mad Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-10 16:54 -0800

csiph-web