[issue28306] incorrect output "int division or modulo by zero" in Handling Exceptions tutorial

2016-09-28 Thread Viorel Tabara

New submission from Viorel Tabara:

I'm reading the Python 3.5.2 documentation at:
  
   https://docs.python.org/3/tutorial/errors.html#handling-exceptions

which shows the following example:

   >>> def this_fails():
   ... x = 1/0
   ...
   >>> try:
   ... this_fails()
   ... except ZeroDivisionError as err:
   ... print('Handling run-time error:', err)
   ...
   Handling run-time error: int division or modulo by zero 

Running the code as a script produces:

   $ python3 -V
   Python 3.5.2
   $ python3 p.py
   Handling run-time error: division by zero

   $ python2 -V
   Python 2.7.12
   $ python2 p.py
   ('Handling run-time error:', ZeroDivisionError('integer division or modulo 
by zero',))
   
The same output is listed for 3.6 and 3.7 tutorials but I don't have those 
versions installed on my system.

--
assignee: docs@python
components: Documentation
messages: 277657
nosy: docs@python, viorel
priority: normal
severity: normal
status: open
title: incorrect output "int division or modulo by zero" in Handling Exceptions 
tutorial
type: behavior
versions: Python 3.5

___
Python tracker 
<http://bugs.python.org/issue28306>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28315] incorrect "in ?" output in 'divide' example at "Defining Clean-up Actions" in tutorial

2016-09-29 Thread Viorel Tabara

New submission from Viorel Tabara:

At https://docs.python.org/3.5/tutorial/errors.html#defining-clean-up-actions 
when I'm running the "divide('2', '1')" example I get:

  File "", line 1, in 

instead of the documentation output of:

   File "", line 1, in ? 

The same message is included with the 2.7 tutorial.

To wit:

   $ python3
   Python 3.5.2 (default, Sep 14 2016, 11:28:32)
   [GCC 6.2.1 20160901 (Red Hat 6.2.1-1)] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>> def divide(x, y):
   ... try:
   ... result = x / y
   ... except ZeroDivisionError:
   ... print('division by zero!')
   ... else:
   ... print('result is', result)
   ... finally:
   ... print('executing finally clause')
   ...
   >>> divide(2, 1)
   result is 2.0
   executing finally clause
   >>> divide(2, 0)
   division by zero!
   executing finally clause
   >>> divide('2', '1')
   executing finally clause
   Traceback (most recent call last):
   File "", line 1, in 
   File "", line 3, in divide
   TypeError: unsupported operand type(s) for /: 'str' and 'str'


   $ python2
   Python 2.7.12 (default, Sep  2 2016, 15:40:50)
   [GCC 6.2.1 20160901 (Red Hat 6.2.1-1)] on linux2
   Type "help", "copyright", "credits" or "license" for more information.
   >>> def divide(x, y):
   ... result = x / y
   KeyboardInterrupt
   >>> def divide(x, y):
   ... try:
   ... result = x / y
   ... except ZeroDivisionError:
   ... print('division by zero!')
   ... else:
   ... print('result is', result)
   ... finally:
   ... print('executing finally clause')
   ...
   >>> divide(2, 1)
   ('result is', 2)
   executing finally clause
   >>> divide(2, 0)
   division by zero!
   executing finally clause
   >>> divide('2', '1')
   executing finally clause
   Traceback (most recent call last):
   File "", line 1, in 
   File "", line 3, in divide
   TypeError: unsupported operand type(s) for /: 'str' and 'str'
  

Nice tutorial by the way ;) Thanks!

--
assignee: docs@python
components: Documentation
messages: 277731
nosy: docs@python, viorel
priority: normal
severity: normal
status: open
title: incorrect "in ?" output in 'divide' example at "Defining Clean-up 
Actions" in tutorial
type: behavior
versions: Python 2.7, Python 3.5

___
Python tracker 
<http://bugs.python.org/issue28315>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28677] difficult to parse sentence structure in "When an instance attribute is referenced that isn't a data attribute"

2016-11-12 Thread Viorel Tabara

New submission from Viorel Tabara:

Method objects are explained at:

https://docs.python.org/3/tutorial/classes.html#method-objects

I'd like to suggest a change from:

   When an instance attribute is referenced that isn’t a data attribute, its 
   class is searched. 

to something along this line:

   When an instance attribute --- that isn’t a data attribute --- is 
   referenced, the instance parent class will be searched.

--
assignee: docs@python
components: Documentation
messages: 280671
nosy: docs@python, viorel
priority: normal
severity: normal
status: open
title: difficult to parse sentence structure in "When an instance attribute is 
referenced that isn't a data attribute"
type: enhancement

___
Python tracker 
<http://bugs.python.org/issue28677>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28677] difficult to parse sentence structure in "When an instance attribute is referenced that isn't a data attribute"

2016-11-13 Thread Viorel Tabara

Viorel Tabara added the comment:

David, that sounds clear enough to me, thanks. However, English isn't my first 
language so I can't comment on the grammatical subtleties.

--

___
Python tracker 
<http://bugs.python.org/issue28677>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com