[issue20467] Confusing wording about __init__

2014-11-30 Thread Simeon Visser

Simeon Visser added the comment:

Is it worth clarifying that __init__ can return a value but only the value 
None? The following won't raise a TypeError:

class O(object):
def __init__(self):
return None

Admittedly the "return None" is the default behaviour but people may attempt 
this in order to "block creation" of the instance (as __new__ is less 
well-known, I have seen the above attempted on Stack Overflow: 
http://stackoverflow.com/questions/26896941/proper-way-to-terminate-object-creation-inside-of-init/)

--
nosy: +simeon.visser

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



[issue22979] Use of None in min and max

2014-12-02 Thread Simeon Visser

Simeon Visser added the comment:

This doesn't happen in Python 3 as None can't be compared to other elements:

>>> min([1,2,3,None])
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unorderable types: NoneType() < int()

I can also imagine people now using min with the intended behaviour of "give me 
the smallest element, or None if it happens to be present".

--
nosy: +simeon.visser

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



[issue22979] Use of None in min and max

2014-12-02 Thread Simeon Visser

Simeon Visser added the comment:

So, to clarify, as the problem no longer occurs in Python 3 (as it requires the 
caller to provide only orderable objects) I'm not sure a meaningful change can 
be made here. It would require changing the behaviour of min/max in Python 
2.7.x in a way that could break existing code.

--

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



[issue22994] datetime buggy

2014-12-04 Thread Simeon Visser

Simeon Visser added the comment:

Datetimes in local timezones should be created using localize():

>>> zon.localize(datetime.datetime(2015, 2, 1)).isoformat()
'2015-02-01T00:00:00-08:00'

See the two supported methods of creating local datetimes at: 
http://pytz.sourceforge.net

--
nosy: +simeon.visser

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



[issue22997] Minor improvements to "Functional API" section of Enum documentation

2014-12-04 Thread Simeon Visser

New submission from Simeon Visser:

This patch contributes two changes to the "Functional API" section of the Enum 
documentation:

- Early in the section it mentions four different ways of creating an Enum but 
later it only lists three different ways (the "sequence of names" approach 
wasn't listed anymore).

- The use of "Animal" and "Animals" wasn't consistent.

This issue is mainly to test my ability to make a (trivial) patch.

--
assignee: docs@python
components: Documentation
messages: 232142
nosy: docs@python, simeon.visser
priority: normal
severity: normal
status: open
title: Minor improvements to "Functional API" section of Enum documentation
type: enhancement
versions: Python 3.5

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



[issue22997] Minor improvements to "Functional API" section of Enum documentation

2014-12-04 Thread Simeon Visser

Changes by Simeon Visser :


--
keywords: +patch
Added file: http://bugs.python.org/file37360/issue22997.patch

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



[issue23011] Duplicate Paragraph in documentation for json module

2014-12-08 Thread Simeon Visser

Simeon Visser added the comment:

What paragraph are you referring to? Various documented parameters are similar 
but I don't see duplicate paragraphs.

--
nosy: +simeon.visser

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