[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2019-03-22 Thread Yongzhi Pan


Yongzhi Pan  added the comment:

On macOS with Python 3.7.2, using pitrou's code, I suspect Python does not 
delete some semaphores used by Queue.

Run these: 

import multiprocessing
import os
import threading

os.system('lsof -p {} | grep -v txt'.format(os.getpid()))
q = multiprocessing.Queue()
q.put(1)
q.get()
threading.enumerate()
os.system('lsof -p {} | grep -v txt'.format(os.getpid()))
q.close()
threading.enumerate()
os.system('lsof -p {} | grep -v txt'.format(os.getpid()))

I see:
>>> import multiprocessing
>>> import os
>>> import threading
>>> 
>>> os.system('lsof -p {} | grep -v txt'.format(os.getpid()))
COMMAND   PID USER   FD   TYPE DEVICE  SIZE/OFF NODE NAME
Python  56029  tux  cwdDIR1,496  1927156 /Users/tux/Desktop
Python  56029  tux0u   CHR   16,2 0t2867183 2393 /dev/ttys002
Python  56029  tux1u   CHR   16,2 0t2867183 2393 /dev/ttys002
Python  56029  tux2u   CHR   16,2 0t2867183 2393 /dev/ttys002
0
>>> q = multiprocessing.Queue()
>>> q.put(1)
>>> q.get()
1
>>> threading.enumerate()
[<_MainThread(MainThread, started 4570830272)>, ]
>>> os.system('lsof -p {} | grep -v txt'.format(os.getpid()))
COMMAND   PID USER   FD TYPE DEVICE  SIZE/OFF NODE NAME
Python  56029  tux  cwd  DIR1,496  1927156 
/Users/tux/Desktop
Python  56029  tux0u CHR   16,2 0t2867914 2393 
/dev/ttys002
Python  56029  tux1u CHR   16,2 0t2867914 2393 
/dev/ttys002
Python  56029  tux2u CHR   16,2 0t2867914 2393 
/dev/ttys002
Python  56029  tux3 PIPE 0x5ab56e2f13ca4abb 16384  
->0x5ab56e2f13ca5a7b
Python  56029  tux4 PIPE 0x5ab56e2f13ca5a7b 16384  
->0x5ab56e2f13ca4abb
Python  56029  tux5r  PSXSEM  0t0  
/mp-oa1x27kb
Python  56029  tux6r  PSXSEM  0t0  
/mp-khu1swie
Python  56029  tux7r  PSXSEM  0t0  
/mp-pwrgzmzz
0
>>> q.close()
>>> threading.enumerate()
[<_MainThread(MainThread, started 4570830272)>]
>>> os.system('lsof -p {} | grep -v txt'.format(os.getpid()))
COMMAND   PID USER   FD TYPE DEVICE  SIZE/OFF NODE NAME
Python  56029  tux  cwd  DIR1,496  1927156 /Users/tux/Desktop
Python  56029  tux0u CHR   16,2 0t2869010 2393 /dev/ttys002
Python  56029  tux1u CHR   16,2 0t2869010 2393 /dev/ttys002
Python  56029  tux2u CHR   16,2 0t2869010 2393 /dev/ttys002
Python  56029  tux5r  PSXSEM  0t0  /mp-oa1x27kb
Python  56029  tux6r  PSXSEM  0t0  /mp-khu1swie
Python  56029  tux7r  PSXSEM  0t0  /mp-pwrgzmzz

The three PSXSEM persists even after some time. Is this some type of leakage?

--

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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2019-03-21 Thread Yongzhi Pan


Change by Yongzhi Pan :


--
nosy: +fossilet

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



[issue18018] SystemError: Parent module '' not loaded, cannot perform relative import

2016-01-14 Thread Yongzhi Pan

Changes by Yongzhi Pan <panyong...@gmail.com>:


--
nosy: +fossilet

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



[issue24752] SystemError when importing from a non-package directory

2015-07-30 Thread Yongzhi Pan

New submission from Yongzhi Pan:

In an empty dir, e.g. Desktop, the following import raises SystemError:

 from . import foo
Traceback (most recent call last):
  File stdin, line 1, in module
SystemError: Parent module '' not loaded, cannot perform relative import

The documentation says that SystemError should be reported as a bug.

--
components: Interpreter Core
messages: 247653
nosy: fossilet
priority: normal
severity: normal
status: open
title: SystemError when importing from a non-package directory
versions: Python 3.4

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



[issue23589] Redundant sentence in FAQ

2015-03-06 Thread Yongzhi Pan

Yongzhi Pan added the comment:

Or:

In Python, variables inside a function that are only referenced but not 
assigned are implicitly global.?

--

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



[issue23589] Redundant sentence in FAQ

2015-03-06 Thread Yongzhi Pan

Yongzhi Pan added the comment:

What about changing the first sentence to:

In Python, variables that are only referenced but not assigned inside a 
function are implicitly global.?

--

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



[issue23589] Redundant sentence in FAQ

2015-03-05 Thread Yongzhi Pan

New submission from Yongzhi Pan:

In 
https://docs.python.org/3/faq/programming.html#what-are-the-rules-for-local-and-global-variables-in-python,
 two sentences of essentially the same meaning exist. I try to remove this 
redundancy.

--
assignee: docs@python
components: Documentation
files: faq_fix.diff
keywords: patch
messages: 237248
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: Redundant sentence in FAQ
type: enhancement
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file38339/faq_fix.diff

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



[issue14544] Limit global keyword name conflicts in language spec to those enforced by CPython

2015-03-05 Thread Yongzhi Pan

Changes by Yongzhi Pan panyong...@gmail.com:


--
nosy: +fossilet

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



[issue23589] Redundant sentence in FAQ

2015-03-05 Thread Yongzhi Pan

Yongzhi Pan added the comment:

Updated diff as Raymond's wording.

--
Added file: http://bugs.python.org/file38340/faq_fix_1.diff

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



[issue8350] Document lack of support for keyword arguments in C functions

2014-11-03 Thread Yongzhi Pan

Changes by Yongzhi Pan panyong...@gmail.com:


--
nosy: +fossilet

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



[issue22379] Empty exception message of str.join

2014-09-27 Thread Yongzhi Pan

Yongzhi Pan added the comment:

Do the patches still have problems?

--

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



[issue22379] Empty exception message of str.join

2014-09-16 Thread Yongzhi Pan

Yongzhi Pan added the comment:

I tested it and find str of an exception does not contain the exception type:

 a = TypeError()
 str(a)
''
 a = TypeError('b', 3)
 a.args
('b', 3)
 str(a)
('b', 3)

Am I missing some other circumstances?

--

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



[issue22379] Empty exception message of str.join

2014-09-15 Thread Yongzhi Pan

Yongzhi Pan added the comment:

I have updated the test for 3.5. The related tests pass after the patching. Are 
they OK now? 

There are two caveats: I did not update test_bytes in 2.7, and I did not add 
checkraises in test_bytes in 3.5.

--
Added file: http://bugs.python.org/file36621/test_for_35-1.diff

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



[issue22379] Empty exception message of str.join

2014-09-12 Thread Yongzhi Pan

Changes by Yongzhi Pan fossi...@users.sourceforge.net:


--
versions: +Python 3.5
Added file: http://bugs.python.org/file36604/str_join_exception_message_1.diff

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



[issue22379] Empty exception message of str.join

2014-09-12 Thread Yongzhi Pan

Yongzhi Pan added the comment:

I updated the patches. Since exceptions in 3 do not have a message attribute, I 
did not check them. Are they OK?

--
Added file: http://bugs.python.org/file36605/test_for_35.diff

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



[issue22379] Empty exception message of str.join

2014-09-09 Thread Yongzhi Pan

New submission from Yongzhi Pan:

In the 2.7 branch, the exception message of str.join is missing when the 
argument is non-sequence:

 ' '.join(None)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError

I fix this with a patch. After this:

 ' '.join(None)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: can only join an iterable

I also add test to this case. Can the test also be added to 3.x branches?

--
components: ctypes
files: str_join_exception_message.diff
keywords: patch
messages: 226675
nosy: fossilet
priority: normal
severity: normal
status: open
title: Empty exception message of str.join
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file36589/str_join_exception_message.diff

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



[issue14228] It is impossible to catch sigint on startup in python code

2013-12-17 Thread Yongzhi Pan

Changes by Yongzhi Pan fossi...@users.sourceforge.net:


--
nosy: +fossilet

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



[issue18885] handle EINTR in the stdlib

2013-12-10 Thread Yongzhi Pan

Changes by Yongzhi Pan fossi...@users.sourceforge.net:


--
nosy: +fossilet

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



[issue12634] Random Remarks in class documentation

2013-04-24 Thread Yongzhi Pan

Yongzhi Pan added the comment:

It may be worth to noting that when creating property attribute using the 
property decorator, we may tend to name the method using nouns, like here:
http://docs.python.org/2/library/functions.html#property

This is when I once overided data attribute with method.

--

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



[issue16438] Numeric operator predecence confusing

2012-11-21 Thread Yongzhi Pan

Yongzhi Pan added the comment:

One possible solution:

We do not list priorities of the operations, instead link to the precedence 
table in the language reference.

--

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



[issue16470] Backport set and dictionary comprehensions in tutorial to 2.7

2012-11-16 Thread Yongzhi Pan

Yongzhi Pan added the comment:

I updated the patch according to the code review. Hope now it is OK.

--
Added file: http://bugs.python.org/file27995/set_and_dict_comprehensions_1.diff

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



[issue2333] Backport set and dict comprehensions

2012-11-14 Thread Yongzhi Pan

Yongzhi Pan added the comment:

I think metal means that the different ways set is repr'd in 2.7 and 3.

In 2.7:

In [9]: a = {x for x in 'abracadabra' if x not in 'abc'}

In [10]: repr(a)
Out[10]: set(['r', 'd'])

In 3.2:
In [6]: a = {x for x in 'abracadabra' if x not in 'abc'}

In [7]: repr(a)
Out[7]: {'r', 'd'}

We were saying not changing __repr__ in #2335.

--

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



[issue2333] Backport set and dict comprehensions

2012-11-13 Thread Yongzhi Pan

Yongzhi Pan added the comment:

Great they are backported to 2.7.  Dictionary and set comprehensions are not 
documented in the tutorial of 2.7, though they are in the language reference. 
Is it OK to add these to the tutorial? I've uploaded a patch.

--
nosy: +fossilet
Added file: http://bugs.python.org/file27981/set_and_dict_comprehensions.diff

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



[issue16470] Backport set and dictionary comprehensions in tutorial to 2.7

2012-11-13 Thread Yongzhi Pan

New submission from Yongzhi Pan:

Dictionary and set comprehensions are backported to 2.7 in issue #2333. The are 
not documented in the tutorial of 2.7, though they are in the language 
reference. Is it OK to add these to the tutorial? I've uploaded a patch.

--
assignee: docs@python
components: Documentation
files: set_and_dict_comprehensions.diff
keywords: patch
messages: 175547
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: Backport set and dictionary comprehensions in tutorial to 2.7
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file27982/set_and_dict_comprehensions.diff

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



[issue16435] Python 3 doc link to Python 2 FAQ

2012-11-08 Thread Yongzhi Pan

New submission from Yongzhi Pan:

http://docs.python.org/3/tutorial/whatnow.html

The last paragraph links to http://www.python.org/doc/faq/, which defaults to 
Python 2 FAQ.

--
assignee: docs@python
components: Documentation
messages: 175156
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: Python 3 doc link to Python 2 FAQ
versions: Python 3.2, Python 3.3

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



[issue16436] Missing anchor in doc

2012-11-08 Thread Yongzhi Pan

New submission from Yongzhi Pan:

http://docs.python.org/3/library/functions.html#func-frozenset

http://docs.python.org/3/library/functions.html#func-set

frozenset and set function have no links to their definitions. Also the anchor 
name is prefixed with func, which is different to other builtin functions.

--
assignee: docs@python
components: Documentation
messages: 175157
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: Missing anchor in doc
versions: Python 3.3, Python 3.4

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



[issue16437] issubclass doc improvement

2012-11-08 Thread Yongzhi Pan

New submission from Yongzhi Pan:

http://docs.python.org/3/library/functions.html#issubclass

classinfo may be a tuple of class objects.

I suggest make it clear like isinstance, use something like this:

classinfo may be a tuple of class objects and such tuples.

--
assignee: docs@python
components: Documentation
messages: 175158
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: issubclass doc improvement
versions: Python 3.3, Python 3.4

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



[issue16438] Numeric operator predecence confusing

2012-11-08 Thread Yongzhi Pan

New submission from Yongzhi Pan:

http://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex

All numeric types (except complex) support the following operations, sorted by 
ascending priority.

It list '-' after '+', '/' after '*'. That is to mean '-' has higher precedence 
than '+'. That is wrong, and is contradicting with here:

http://docs.python.org/3/reference/expressions.html#summary

This should be made clear.

--
assignee: docs@python
components: Documentation
messages: 175163
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: Numeric operator predecence confusing
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue16439] Code not collapsed correctly

2012-11-08 Thread Yongzhi Pan

New submission from Yongzhi Pan:

http://docs.python.org/3/library/stdtypes.html#str.title

The second snippets is not collapsed correctly.

--
assignee: docs@python
components: Documentation
messages: 175171
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: Code not collapsed correctly
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue16438] Numeric operator predecence confusing

2012-11-08 Thread Yongzhi Pan

Yongzhi Pan added the comment:

I mean the text at the first link need fix. '+' and '-' are not on the same 
row. And the doc says: sorted by ascending priority, that means they have 
ascending priority.

The table in the reference is just right.

--

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



[issue16440] Exception type

2012-11-08 Thread Yongzhi Pan

New submission from Yongzhi Pan:

http://docs.python.org/3/library/stdtypes.html#methods

Attempting to set a method attribute results in a TypeError being raised.

But in the example, if we do c.method.whoami = 'c', we get AttributeError 
instead of TypeError.

--
assignee: docs@python
components: Documentation
messages: 175174
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: Exception type
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue12634] Random Remarks in class documentation

2012-11-04 Thread Yongzhi Pan

Changes by Yongzhi Pan fossi...@users.sourceforge.net:


--
nosy: +fossilet

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



[issue16048] Tutorial-classes-remarks: replace paragraph

2012-11-03 Thread Yongzhi Pan

Changes by Yongzhi Pan fossi...@users.sourceforge.net:


--
nosy: +fossilet

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



[issue6829] Frendly error message when inheriting from function

2012-10-31 Thread Yongzhi Pan

Changes by Yongzhi Pan fossi...@users.sourceforge.net:


--
nosy: +fossilet

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



[issue16294] 8 space indent in tutorial

2012-10-21 Thread Yongzhi Pan

New submission from Yongzhi Pan:

http://docs.python.org/py3k/tutorial/stdlib2.html#weak-references

In the code example, the two class funtions' bodies have indents of 8 spaces. 
All other indents in the docs are 4 spaces. I suggest here we use 4 spaces also.

--
assignee: docs@python
components: Documentation
messages: 173443
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: 8 space indent in tutorial
type: enhancement
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue16265] Code sample does not collapse correctly

2012-10-17 Thread Yongzhi Pan

New submission from Yongzhi Pan:

http://docs.python.org/py3k/tutorial/inputoutput.html#fancier-output-formatting

In the last but second code sample in that section, the code is not correctly 
colored and cannot be correctly collapsed.

Expanded:

 table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
 print ('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '
...'Dcab: {0[Dcab]:d}'.format(table))
Jack: 4098; Sjoerd: 4127; Dcab: 8637678

Collapsed:

table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '

--
assignee: docs@python
components: Documentation
messages: 173163
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: Code sample does not collapse correctly
type: behavior
versions: Python 3.2, Python 3.3

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



[issue16266] Typo in tutorial

2012-10-17 Thread Yongzhi Pan

New submission from Yongzhi Pan:

http://docs.python.org/py3k/tutorial/inputoutput.html#reading-and-writing-files

The text:

In text mode, the default is to convert platform-specific line endings (\n on 
Unix, \r\n on Windows) to just \n on reading and \n back to platform-specific 
line endings on writing. 

Is the last '\n' a typo and not needed?

--
assignee: docs@python
components: Documentation
messages: 173165
nosy: docs@python, fossilet
priority: normal
severity: normal
status: open
title: Typo in tutorial
type: behavior
versions: Python 3.2, Python 3.3

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



[issue4749] Issue with RotatingFileHandler logging handler on Windows

2012-10-11 Thread Yongzhi Pan

Changes by Yongzhi Pan fossi...@users.sourceforge.net:


--
nosy: +fossilet

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



[issue15342] os.path.join behavior

2012-07-15 Thread Yongzhi Pan

Yongzhi Pan fossi...@users.sourceforge.net added the comment:

I suggest append An empty last part will result in a path that ends with a 
separator or something similar to the docstring, though it is already in the 
HTML documentation. 

Suppose someone does this like me:

In [10]: join('a', sep)
Out[10]: '/'

He must be surprised. He has to guess how to append a separator if he does not 
look at the code, or fiddle around until he finds the soultion. 

Given it explained in the docstring, after he sees:

In [10]: join('a', sep)
Out[10]: '/'

He will probably look at the docstring:

In [16]: join?
Type:   function
Base Class: type 'function'
String Form:function join at 0x7f053fc93ed8
Namespace:  Interactive
File:   /usr/lib/python2.7/posixpath.py
Definition: join(a, *p)
Docstring:
Join two or more pathname components, inserting '/' as needed.
If any component is an absolute path, all previous path components
will be discarded. An empty last part will result in a path that
ends with a separator.

Ok, he immediately knows he has to supply an empty string instead of a 
separator.

--

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