[issue30699] Misleading class names in datetime.tzinfo usage examples

2017-06-18 Thread Robert Tasarz

New submission from Robert Tasarz:

https://docs.python.org/3/library/datetime.html#datetime-objects
gives in an example two classes named GMT1 and GMT2 subclassing tzinfo, defined 
with dst(…) methods returning one hour timedelta for summer periods. This is in 
conflict with naming, as GMT timezone is not defined with any daylight saving 
time, so any timezone offsetted from it shouldn't be as well. I would suggest 
renaming them to something like BrusselsTZ and HelsinkiTZ (with a comment that 
this is simplified implementation, that doesn't account for exact hour when dst 
switch is made, and maybe mentioning pytz) and tzname(…) to return ('CET', 
'CEST')[bool(self.dst(dt))] and ('EET', 'EEST')[bool(self.dst(dt))] accordingly.

Also https://docs.python.org/3/library/datetime.html#time-objects
has an example with GMT1 class, though this time dst(…) unconditionally returns 
offset 0 properly, tzname(…) gives 'Europe/Prague' – region that uses dst. IMHO 
returning any of: "CET", "GMT+1", "Africa/Tunis" would be better here.

--
assignee: docs@python
components: Documentation
messages: 296296
nosy: Robert.Tasarz, docs@python
priority: normal
severity: normal
status: open
title: Misleading class names in datetime.tzinfo usage examples
type: enhancement
versions: Python 2.7, Python 3.6

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



[issue17702] os.environ converts key type from string to bytes in KeyError exception

2013-04-11 Thread Robert Tasarz

New submission from Robert Tasarz:

Minimal example:

>>> import os
>>> somekey = 'random'
>>> try:
...   os.environ[somekey]
... except KeyError as e:
...   print(repr(e))
...   somekey == e.args[0]
... 
KeyError(b'random',)
False

Tested in Python 3.3.1 on Debian

--
components: Extension Modules
messages: 186604
nosy: Robert.Tasarz
priority: normal
severity: normal
status: open
title: os.environ converts key type from string to bytes in KeyError exception
versions: Python 3.3

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



[issue17702] os.environ converts key type from string to bytes in KeyError exception

2013-04-11 Thread Robert Tasarz

Changes by Robert Tasarz :


--
type:  -> behavior

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