Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(python': 0.05; 'subject:Python': 0.05; 'bytes.': 0.07; 'subject:missing': 0.07; 'python': 0.08; 'intern': 0.09; 'api': 0.09; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'functions),': 0.16; "languages'": 0.16; 'subject:String': 0.16; 'putting': 0.28; 'message-id:@mail.gmail.com': 0.28; 'str': 0.30; 'subject:?': 0.30; 'does': 0.32; "can't": 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.37; 'received:209.85': 0.38; 'either': 0.39; '(with': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.40; 'huge': 0.60; 'concept': 0.74; '(bytes)': 0.84; 'dict,': 0.84; 'eponymous': 0.84; 'subject:moved': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=5/1jRg5UTF5BsEfqdUnzGleFejEPt60GC5xXphL3vSc=; b=EbGiOJsaTg9sNlQSYqGFs0L6slo0w7Lg9mT3lBcAuSJzS0J5reyyvFxaU6PVxCDXjc +ZRgeYkbBUN/cRmWSmGBdaw5dLEVPMFF8537xPGwfoAO4oBGSqXDrqDGrFWAU4HOtpHo 8HChP6O6g7Oxo4NzwF2ieauIDPUcGPyuhBHdk= MIME-Version: 1.0 Date: Tue, 24 Jan 2012 11:38:36 +1100 Subject: String interning in Python 3 - missing or moved? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1327365518 news.xs4all.nl 6943 [2001:888:2000:d::a6]:58409 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19303 Python 2 can intern 'str' (bytes) strings (with the eponymous builtin, and with C API functions), though not unicode. Python 3 does not have that builtin, nor the C API; I can't find any support for either str or bytes. Has it been moved, or is interning as a concept deprecated? I don't have a use case, just curiosity at the moment - looking into various languages' dictionary/mapping implementations (Python hashes strings for each dict, Lua interns them - by basically putting them all into one huge hashtable). ChrisA