Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6331277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:01:58+00:00 2026-05-24T18:01:58+00:00

[ Excluding any test code that just mocks a builtin ] Given that many

  • 0

[Excluding any test code that just mocks a builtin]

Given that many builtins have been added over time, if there are multiple occurrences, I’d accept an answer showing a module or some code that was created after that builtin existed.

My rationale for asking is that after posting a question on the python mailing list, some of the responses indicated that there are members of the Python community that think its
perfectly reasonable to use variable names that shadow builtins when any other name would work just as well.

I’d like to use the standard library as a gauge to how common this practice is among the various Python developers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:02:00+00:00Added an answer on May 24, 2026 at 6:02 pm

    The builtin I most often shadow is id, both because it’s so useful as a variable name, and the builtin is so rarely called anyway. A quick look in the 2.7 standard library turned up a number of uses:

    aifc.py:            if id == marker[0]:
    aifc.py:                id = _read_short(chunk)
    aifc.py:            if id == self._markers[i][0]:
    aifc.py:            if id == marker[0]:
    difflib.py:            id = ' id="%s%s"' % (self._prefix[side],linenum)
    difflib.py:            id = ''
    nntplib.py:        id = ''
    nntplib.py:                id = words[2]
    nntplib.py:        resp, nr, id = self.statparse(resp)
    pdb.py:            id = idstring[0].strip()
    pdb.py:            id = idstring[1].strip()
    pdb.py:        if id == '': return failed
    platform.py:                id = values[2]
    platform.py:    id = ''
    platform.py:            id = l[1]
    platform.py:        id = _id
    

    There are plenty of uses of str, list, and int also:

    Cookie.py:    str = str[1:-1]
    mailcap.py:        str = os.environ['MAILCAPS']
    mimetools.py:        str = self.typeheader
    mimetools.py:            str = 'text/plain'
    mimetools.py:            str = str[:i]
    mimetools.py:        str = self.plisttext
    mimetools.py:            str = str[1:]
    mimetools.py:            str = str[end:]
    rfc822.py:  str = m.getheader(name)
    rfc822.py:  str = m.getrawheader(name)
    smtplib.py:            str = ""
    smtplib.py:            str = '%s%s' % (cmd, CRLF)
    smtplib.py:            str = '%s %s%s' % (cmd, args, CRLF)
    sre_parse.py:    pattern.str = str
    xmllib.py:            str = res.group(1)
    xmllib.py:                    str = chr(int(str[2:], 16))
    xmllib.py:                    str = chr(int(str[1:]))
    xmllib.py:                    str = self.entitydefs[str]
    xmllib.py:                    str = '&' + str + ';'
    
    uuid.py:            int = long(hex, 16)
    uuid.py:            int = long(('%02x'*16) % tuple(map(ord, bytes)), 16)
    uuid.py:            int = ((time_low << 96L) | (time_mid << 80L) |
    
    SimpleHTTPServer.py:            list = os.listdir(path)
    StringIO.py:list = f.readlines()# list of f.readline() results until EOF
    StringIO.py:    list = f.readlines()
    anydbm.py:        list = d.keys() # return a list of all existing keys (slow!)
    asynchat.py:            self.list = deque()
    asynchat.py:            self.list = deque(list)
    bdb.py:        list = self.breaks[filename]
    cgi.py:    list = None
    cgi.py:    list = traceback.format_tb(tb, limit) + \
    code.py:        list = traceback.format_exception_only(type, value)
    code.py:            list = traceback.format_list(tblist)
    dircache.py:        cached_mtime, list = cache[path]
    dircache.py:        cached_mtime, list = -1, []
    dircache.py:        list = os.listdir(path)
    mailbox.py:        # list = map(long, filter(pat.match, os.listdir(self.dirname)))
    mailbox.py:        list = os.listdir(self.dirname)
    mailbox.py:        list = filter(pat.match, list)
    mailbox.py:        list = map(long, list)
    mhlib.py:list = mh.listfolders() # names of top-level folders
    mhlib.py:list = mh.listallfolders() # names of all folders, including subfolders
    mhlib.py:list = mh.listsubfolders(name) # direct subfolders of given folder
    mhlib.py:list = mh.listallsubfolders(name) # all subfolders of given folder
    mhlib.py:list = f.listmessages() # list of messages in folder (as numbers)
    mhlib.py:list = f.parsesequence(seq)     # parse msgs syntax into list of messages
    mhlib.py:            list = []
    mhlib.py:        list = map(int, stuff.split())
    multifile.py:        list = []
    nntplib.py:            list = []
    nntplib.py:        resp, list = self.longcmd('LIST', file)
    nntplib.py:        resp, list = self.longcmd(line, file)
    pickle.py:        list = stack[-1]
    pickle.py:        list = stack[mark - 1]
    pipes.py:    list = []
    poplib.py:        list = []; octets = 0
    pstats.py:        width, list = self.get_print_list(amount)
    pstats.py:        width, list = self.get_print_list(amount)
    pstats.py:        width, list = self.get_print_list(amount)
    rexec.py:        list = []
    rfc822.py:  list = m.getaddrlist(name)
    shelve.py:        list = d.keys() # a list of all existing keys (slow!)
    socket.py:        list = []
    telnetlib.py:        list = list[:]
    traceback.py:    list = []
    traceback.py:    list = []
    traceback.py:        list = ['Traceback (most recent call last):\n']
    traceback.py:        list = list + format_tb(tb, limit)
    traceback.py:        list = []
    traceback.py:    list = list + format_exception_only(etype, value)
    traceback.py:    list = []
    xdrlib.py:        list = []
    xdrlib.py:        list = []
    

    and there are too many file and dir uses to post…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to create a regular expressions pattern that matches any reference
EDIT: i have added in all of my code (excluding package and imports.....) and
I am trying to run xcopy that copies files excluding .obj, etc. What I
How do I copy a directory including sub directories excluding files or directories that
I have a many-to-many relationship between two objects with a join table. I need
how would you extract the domain name from a URL, excluding any subdomains? My
I have the html: <p> <a href=#>click here</a> Welcome </p> And I just want
Before any of my article controller crud actions can run (excluding index), i want
Say I have my sources in my src/ tree (and possibly in my test/
Given a body of HTML, is there any function out there someone has written

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.