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


Groups > comp.lang.python > #11595

Re: Why no warnings when re-assigning builtin names?

Date 2011-08-16 13:34 -0500
From Tim Chase <python.list@tim.thechases.com>
Subject Re: Why no warnings when re-assigning builtin names?
References (3 earlier) <mailman.34.1313464992.27778.python-list@python.org> <4e49fcd7$0$29974$c3e8da3$5496439d@news.astraweb.com> <2A3EB048-1F10-46E8-973F-9BBD303E7B9F@semanchuk.com> <mailman.70.1313508227.27778.python-list@python.org> <slrnj4l90t.1pqc.usenet-nospam@guild.seebs.net>
Newsgroups comp.lang.python
Message-ID <mailman.93.1313519705.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 08/16/2011 12:11 PM, Seebs wrote:
> Under which circumstance will you have more problems?
>
> 1.  There is not a single shadowed built-in in the entire project.
> 2.  There are dozens of shadowed built-ins based on when the original
> programmer felt there wasn't going to be a need for a given built-in
> feature, or possibly just didn't know about it.

In practice, I've never hit such a snag.  For #2, the only way it 
would impact me is if I did the ill-advised

   from shadowy import *

which might tromp on things I care about.  Otherwise, I'd just do 
something like

   from shadowy import list as shadowy_list, id as shadowy_id

If I'm altering another person's ill-created module, I might 
consider doing a search for builtins and then just simply 
patching the module so that it renamed all the shadowing usages. 
  Unless the author was being particularly obscure (using scope 
to impact where a builtin meant the builtin, and other scopes to 
shadow the builtins), most authors are pretty consistent in their 
shadowing (usually ignorant of the fact they're shadowing the 
builtin) which makes the search-n-replace an easy tweak.

-tkc




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


Thread

Re: Why no warnings when re-assigning builtin names? Chris Angelico <rosuav@gmail.com> - 2011-08-15 23:15 +0100
  Re: Why no warnings when re-assigning builtin names? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-16 11:32 +1000
    Re: Why no warnings when re-assigning builtin names? Philip Semanchuk <philip@semanchuk.com> - 2011-08-15 23:23 -0400
      Re: Why no warnings when re-assigning builtin names? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-16 15:15 +1000
        Re: Why no warnings when re-assigning builtin names? Philip Semanchuk <philip@semanchuk.com> - 2011-08-16 10:13 -0400
          Re: Why no warnings when re-assigning builtin names? rantingrick <rantingrick@gmail.com> - 2011-08-16 08:44 -0700
            Re: Why no warnings when re-assigning builtin names? Andrew Berg <bahamutzero8825@gmail.com> - 2011-08-16 12:23 -0500
        Re: Why no warnings when re-assigning builtin names? Chris Angelico <rosuav@gmail.com> - 2011-08-16 16:12 +0100
        Re: Why no warnings when re-assigning builtin names? Ethan Furman <ethan@stoneleaf.us> - 2011-08-16 08:41 -0700
          Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-16 17:11 +0000
            Re: Why no warnings when re-assigning builtin names? Ethan Furman <ethan@stoneleaf.us> - 2011-08-16 10:48 -0700
            Re: Why no warnings when re-assigning builtin names? Tim Chase <python.list@tim.thechases.com> - 2011-08-16 13:34 -0500
        Re: Why no warnings when re-assigning builtin names? Philip Semanchuk <philip@semanchuk.com> - 2011-08-16 11:31 -0400
        Re: Why no warnings when re-assigning builtin names? Philip Semanchuk <philip@semanchuk.com> - 2011-08-16 11:38 -0400
        Re: Why no warnings when re-assigning builtin names? Ethan Furman <ethan@stoneleaf.us> - 2011-08-16 09:19 -0700
          Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-16 17:11 +0000
            Re: Why no warnings when re-assigning builtin names? Ethan Furman <ethan@stoneleaf.us> - 2011-08-16 10:43 -0700
              Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-16 18:56 +0000
                Re: Why no warnings when re-assigning builtin names? Terry Reedy <tjreedy@udel.edu> - 2011-08-16 19:32 -0400
                Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-16 23:49 +0000
                Re: Why no warnings when re-assigning builtin names? Chris Angelico <rosuav@gmail.com> - 2011-08-17 01:02 +0100
                Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-17 01:35 +0000
                Re: Why no warnings when re-assigning builtin names? Chris Angelico <rosuav@gmail.com> - 2011-08-17 08:27 +0100
                Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-17 16:33 +0000
                Re: Why no warnings when re-assigning builtin names? Terry Reedy <tjreedy@udel.edu> - 2011-08-16 22:10 -0400
            Re: Why no warnings when re-assigning builtin names? Chris Angelico <rosuav@gmail.com> - 2011-08-16 19:23 +0100
        Re: Why no warnings when re-assigning builtin names? Tim Chase <python.list@tim.thechases.com> - 2011-08-16 11:10 -0500
        Re: Why no warnings when re-assigning builtin names? Philip Semanchuk <philip@semanchuk.com> - 2011-08-16 12:32 -0400
          Re: Why no warnings when re-assigning builtin names? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-17 11:29 +1000
            Re: Why no warnings when re-assigning builtin names? Philip Semanchuk <philip@semanchuk.com> - 2011-08-16 22:16 -0400
        Re: Why no warnings when re-assigning builtin names? Ethan Furman <ethan@stoneleaf.us> - 2011-08-16 10:07 -0700
        Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-16 17:11 +0000
          Re: Why no warnings when re-assigning builtin names? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-17 10:58 +1000
            Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-17 03:17 +0000
              Re: Why no warnings when re-assigning builtin names? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-17 18:15 +1000
                Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-17 16:33 +0000
                Re: Why no warnings when re-assigning builtin names? Ethan Furman <ethan@stoneleaf.us> - 2011-08-17 10:36 -0700
                Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-17 17:36 +0000
                Re: Why no warnings when re-assigning builtin names? Ethan Furman <ethan@stoneleaf.us> - 2011-08-17 11:13 -0700
                Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-17 18:09 +0000
                Re: Why no warnings when re-assigning builtin names? Chris Angelico <rosuav@gmail.com> - 2011-08-17 18:42 +0100
                Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-17 17:38 +0000
                Re: Why no warnings when re-assigning builtin names? Chris Angelico <rosuav@gmail.com> - 2011-08-17 19:02 +0100
                Re: Why no warnings when re-assigning builtin names? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-18 10:36 +1000
            Re: Why no warnings when re-assigning builtin names? Chris Angelico <rosuav@gmail.com> - 2011-08-17 08:34 +0100
        RE: Why no warnings when re-assigning builtin names? "Gerrat Rickert" <grickert@coldstorage.com> - 2011-08-16 13:15 -0400
        Re: Why no warnings when re-assigning builtin names? Terry Reedy <tjreedy@udel.edu> - 2011-08-16 19:29 -0400
        Re: Why no warnings when re-assigning builtin names? Philip Semanchuk <philip@semanchuk.com> - 2011-08-16 20:18 -0400
        Re: Why no warnings when re-assigning builtin names? Terry Reedy <tjreedy@udel.edu> - 2011-08-16 22:15 -0400
        Re: Why no warnings when re-assigning builtin names? Philip Semanchuk <philip@semanchuk.com> - 2011-08-16 22:51 -0400
        RE: Why no warnings when re-assigning builtin names? "Gerrat Rickert" <grickert@coldstorage.com> - 2011-08-17 09:30 -0400
    Re: Why no warnings when re-assigning builtin names? Chris Angelico <rosuav@gmail.com> - 2011-08-16 09:16 +0100
  Re: Why no warnings when re-assigning builtin names? Chris Torek <nospam@torek.net> - 2011-08-31 21:30 +0000
    Re: Why no warnings when re-assigning builtin names? Seebs <usenet-nospam@seebs.net> - 2011-08-31 21:57 +0000

csiph-web