This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fpom
Recipients fpom, r.david.murray, serhiy.storchaka
Date 2017-10-08.16:38:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507480689.1.0.213398074469.issue31726@psf.upfronthosting.co.za>
In-reply-to
Content
I've just launched ipython3 (installed with pip):

$ ipython3
Python 3.4.3 (default, Nov 17 2016, 01:08:31) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import token, tokenize, io

In [2]: token.BACKQUOTE
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-ebc28b79826c> in <module>()
----> 1 token.BACKQUOTE

AttributeError: 'module' object has no attribute 'BACKQUOTE'

In [3]: _tok = next(tokenize.tokenize(io.BytesIO(b"").readline))

In [4]: token.tok_name[_tok.type] = "BACKQUOTE"

In [5]: for number, name in token.tok_name.items() :
   ...:     if not hasattr(token, name) :
   ...:         print(name, "=", number)
   ...:         
COMMENT = 54
NL = 55
BACKQUOTE = 56
ATEQUAL = 57
COMMENT = 58

If instead I use python3 as provided by my Linux Mint, the result is different indeed:

$ python3
Python 3.4.3 (default, Nov 17 2016, 01:08:31) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import token, tokenize, io
>>> token.BACKQUOTE
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'BACKQUOTE'
>>> _tok = next(tokenize.tokenize(io.BytesIO(b"").readline))
>>> token.tok_name[_tok.type] = "BACKQUOTE"
>>> for number, name in token.tok_name.items() :
...     if not hasattr(token, name) :
...         print(name, "=", number)
... 
COMMENT = 54
NL = 55
BACKQUOTE = 56
History
Date User Action Args
2017-10-08 16:38:09fpomsetrecipients: + fpom, r.david.murray, serhiy.storchaka
2017-10-08 16:38:09fpomsetmessageid: <1507480689.1.0.213398074469.issue31726@psf.upfronthosting.co.za>
2017-10-08 16:38:09fpomlinkissue31726 messages
2017-10-08 16:38:08fpomcreate