myreallycoolname added the comment:

I am updating my bug report unfortunatly I am unable to give you a specific 
link due to the fact that I can not find the python3.2 documentation online. I 
do assure you that the docs from my computer are for python3.2 (as I have no 
other docs installed.) To find the docs I'm complaining about go to the index 
select tutorial and click on the classes section. The bad code along with the 
start of the chapter it is located in and the trace backs follow. Please note 
that errors are cumulative. In other words if you use variable a and variable a 
has no value (not created deffined etc.) then every time you use it you will 
get an error. Code follows:



9.2.1. Scopes and Namespaces Example
This is an example demonstrating how to reference the different scopes and 
namespaces, and howglobal and nonlocal affect variable binding:





>>> def scope_test():
...     def do_local():
...         spam = "local spam"
...     def do_nonlocal():
...         nonlocal spam
...         spam = "nonlocal spam"
...     def do_global():
...         global spam
...         spam = "global spam"
... 
SyntaxError: no binding for nonlocal 'spam' found
>>>     spam = "test spam"
  File "<stdin>", line 1
    spam = "test spam"
    ^
IndentationError: unexpected indent
>>>     do_local()
  File "<stdin>", line 1
    do_local()
    ^
IndentationError: unexpected indent
>>>     print("After local assignment:", spam)
  File "<stdin>", line 1
    print("After local assignment:", spam)
    ^
IndentationError: unexpected indent
>>>     do_nonlocal()
  File "<stdin>", line 1
    do_nonlocal()
    ^
IndentationError: unexpected indent
>>>     print("After nonlocal assignment:", spam)
  File "<stdin>", line 1
    print("After nonlocal assignment:", spam)
    ^
IndentationError: unexpected indent
>>>     do_global()
  File "<stdin>", line 1
    do_global()
    ^
IndentationError: unexpected indent
>>>     print("After global assignment:", spam)
  File "<stdin>", line 1
    print("After global assignment:", spam)
    ^
IndentationError: unexpected indent
>>> 
>>> scope_test()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'scope_test' is not defined
>>> print("In global scope:", spam)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'spam' is not defined




9.3.3. Instance Objects
Now what can we do with instance objects? The only operations understood by 
instance objects are attribute references. There are two kinds of valid 
attribute names, data attributes and methods.
data attributes correspond to “instance variables” in Smalltalk, and to “data 
members” in C++. Data attributes need not be declared; like local variables, 
they spring into existence when they are first assigned to. For example, if x 
is the instance of MyClass created above, the following piece of code will 
print the value 16, without leaving a trace:





>>> x.counter = 1
>>> while x.counter < 10:
...     x.counter = x.counter * 2
... print(x.counter)
  File "<stdin>", line 3
    print(x.counter)
        ^
SyntaxError: invalid syntax
>>> del x.counter


9.9. Iterators
By now you have probably noticed that most container objects can be looped over 
using a forstatement:




>>> for element in [1, 2, 3]:
...     print(element)
... for element in (1, 2, 3):
  File "<stdin>", line 3
    for element in (1, 2, 3):
      ^
SyntaxError: invalid syntax
>>>     print(element)
  File "<stdin>", line 1
    print(element)
    ^
IndentationError: unexpected indent
>>> for key in {'one':1, 'two':2}:
...     print(key)
... for char in "123":
  File "<stdin>", line 3
    for char in "123":
      ^
SyntaxError: invalid syntax
>>>     print(char)
  File "<stdin>", line 1
    print(char)
    ^
IndentationError: unexpected indent
>>> for line in open("myfile.txt"):
...     print(line)
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'myfile.txt'
>>> 



This is one html page of errors not just one section. You may also want to 
check the python 3.3 docs for these errors.

----------
status: closed -> open

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16607>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to