[New-bugs-announce] [issue20692] Tutorial section 9.4

Jon Shemitz report at bugs.python.org
Wed Feb 19 23:50:24 CET 2014


New submission from Jon Shemitz:

The tutorial says "Each value is an object, and therefore has a class (also called its type). It is stored as object.__class__."

So, I tried

  >>> 3.__class__
    File "<stdin>", line 1
      3.__class__
                ^
  SyntaxError: invalid syntax

Yet, "foo".__class__ worked, as did 3j.__class__ and 3.5.__class__.

When my son (!) suggested that I try (3).__class__, I did indeed get <type 'int'>, while (3,).__class__ gave <type 'tuple'>.

This *looks like* a minor error in the parser, where seeing \d+\. puts it in a state where it expects \d+ and it can't handle \w+

This may be the sort of thing that only a newbie would even think to try, so may not be worth fixing. If so, it may be worth mentioning in the tutorial.

----------
assignee: docs at python
components: Documentation, Interpreter Core
messages: 211670
nosy: Jon.Shemitz, docs at python
priority: normal
severity: normal
status: open
title: Tutorial section 9.4
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20692>
_______________________________________


More information about the New-bugs-announce mailing list