[issue31936] "5. The import system" grammatical error

2017-11-03 Thread Daniel U. Thibault

New submission from Daniel U. Thibault <d.u.thiba...@gmail.com>:

https://docs.python.org/3/reference/import.html#importsystem
"Other mechanisms for invoking the import system (such as 
importlib.import_module()) may choose to subvert __import__() and use its own 
solution to implement import semantics."
should be
"Other mechanisms for invoking the import system (such as 
importlib.import_module()) may choose to subvert __import__() and use their own 
solution to implement import semantics."

--
assignee: docs@python
components: Documentation
messages: 305489
nosy: Daniel.U..Thibault, docs@python
priority: normal
severity: normal
status: open
title: "5. The import system" grammatical error
type: enhancement
versions: Python 3.8

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



[issue20686] Confusing statement

2014-03-20 Thread Daniel U. Thibault

Daniel U. Thibault added the comment:

The default encoding is normally set to ASCII [...]. When a Unicode string is 
printed, written to a file, or converted with str(), conversion takes place 
using this default encoding.

 uäöü
u'\xe4\xf6\xfc'
   Printing a Unicode string uses ASCII encoding: false (the characters are not 
converted to their ASCII equivalents) (compare with str(), below)

 str(uäöü)
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: 
ordinal not in range(128)
   Converting a Unicode string with str() uses ASCII encoding: true (if print 
(see above) behaved like str(), you'd get an error too)

 f = open('workfile', 'w')
 f.write('This is a «test»\n')
 f.close()
   Writing a Unicode string to a file uses ASCII encoding: false (examination 
of the file reveals UTF-8 characters (hex dump: 54 68 69 73 20 69 73 20 61 20 
C2 AB 74 65 73 74 C2 BB 0A))

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20686
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20686] Confusing statement about unicode strings in tutorial introduction

2014-03-20 Thread Daniel U. Thibault

Daniel U. Thibault added the comment:

 mystring=äöü
 myustring=uäöü

 mystring
'\xc3\xa4\xc3\xb6\xc3\xbc'
 myustring
u'\xe4\xf6\xfc'

 str(mystring)
'\xc3\xa4\xc3\xb6\xc3\xbc'
 str(myustring)
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: 
ordinal not in range(128)

 f = open('workfile', 'w')
 f.write(mystring)
 f.close()
 f = open('workufile', 'w')
 f.write(myustring)
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: 
ordinal not in range(128)
 f.close()

workfile contains C3 A4 C3 B6 C3 BC

So the Unicode string (myustring) does indeed try to convert to ASCII when 
written to file. But not when just printed.

It seems really strange that non-Unicode strings (mystring) should actually be 
more flexible than Unicode strings...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20686
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20686] Confusing statement

2014-02-20 Thread Daniel U. Thibault

Daniel U. Thibault added the comment:

It seems to me the statement is correct as written.  What experiments indicate 
otherwise?

Here's a simple one:

 print «1»

The guillemets are certainly not ASCII (Unicode AB and BB, well outside ASCII's 
7F upper limit) but are rendered as guillemets.  (Guillemets are easy for me 
'cause I use a French keyboard)  I haven't actually checked yet what happens 
when writing to a file.  If Python is unable to write anything but ASCII to 
file, it becomes nearly useless.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20686
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20686] Confusing statement

2014-02-19 Thread Daniel U. Thibault

New submission from Daniel U. Thibault:

Near the end of 3.1.3 
http://docs.python.org/2/tutorial/introduction.html#unicode-strings you can 
read:

When a Unicode string is printed, written to a file, or converted with str(), 
conversion takes place using this default encoding.

This can be interpreted as stating that stating that printing a Unicode string 
(using the print function or the shell's default print behaviour) results in 
ASCII printout.  It can likewise be interpreted as stating that any write of a 
Unicode string to a file converts the string to ASCII.  Experimentation shows 
this is not true.  Perhaps you meant something like this:

When a Unicode string is converted with str() in order to be printed or 
written to a file, conversion takes place using this default encoding.

Grammatical comments: In the statement When a Unicode string is printed, 
written to a file, or converted with str(), conversion takes place using this 
default encoding., the , or puts the three elements of the enumeration on 
the same level (respectively printed, written to a file, and converted 
with str()). The confusion seems to arise because with str() was meant to 
apply to the list as a whole, not just its last element.

--
assignee: docs@python
components: Documentation
messages: 211627
nosy: Daniel.U..Thibault, docs@python
priority: normal
severity: normal
status: open
title: Confusing statement
type: enhancement

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20686
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com