classification
Title: Time module: effect of time.timezone change
Type: Stage: needs patch
Components: Documentation Versions: Python 3.3
process
Status: closed Resolution:
Dependencies: Superseder: Document time module constants (timezone, tzname, etc.) as deprecated.
View: 28157
Assigned To: docs@python Nosy List: belopolsky, docs@python, haypo, terry.reedy
Priority: normal Keywords:

Created on 2012-09-13 18:07 by terry.reedy, last changed 2016-09-15 22:58 by belopolsky. This issue is now closed.

Messages (6)
msg170450 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-09-13 18:07
"time.timezone 
The offset of the local (non-DST) timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK)."

Quite aside from #9305 (UTC is not a place), this does not specify the effect of setting this attribute. It does not change the output of localtime, asctime, or ctime (on Windows). Does is affect anything else? strftime? If setting it has no effect, the doc should say so. (And then perhaps it should be made read-only in the future, as setting it expecting an effect would be a bug.)
msg170467 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2012-09-14 00:51
Isn't this a duplicate of issue 8810?
msg170468 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2012-09-14 01:02
I've read this more carefully and I now understand the issue.  Indeed, setting time.timezone or time.altzone has no effect on say time.strftime('%z').  I think this should be documented and the doc should refer to time.tzset() for a proper way to change these variables.

As for making them read only, I don't think there is a non-hackish way to make module globals read-only.

I also believe that rather than improving these variables we should encourage people to use datetime module's new timezone features because at almost any location on Earth timezone offset is not a constant and varies over time.
msg170469 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-09-14 02:00
#8810 and #9305 seem related, if not dups.

You are right about module vars. They are all instances of one module class with one __setattr__.

How about "Setting this attribute has no effect. See time.TZset or even better, the datetime module." (I had not noticed .altzone)
msg170470 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2012-09-14 02:48
> Setting this attribute has no effect.

Strictly speaking, setting this attribute has the effect of changing the value of this attribute.  I cannot come up with a better wording at this hour, but I would say something about it being "informational" only.  We should also mention that these attributes are set by time.tzset().
msg276635 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2016-09-15 22:58
Closing in favor of #28157.
History
Date User Action Args
2016-09-15 22:58:42belopolskysetstatus: open -> closed
superseder: Document time module constants (timezone, tzname, etc.) as deprecated.
messages: + msg276635
2012-09-14 02:48:03belopolskysetmessages: + msg170470
2012-09-14 02:00:15terry.reedysetmessages: + msg170469
2012-09-14 01:02:18belopolskysetmessages: + msg170468
2012-09-14 00:51:02belopolskysetmessages: + msg170467
2012-09-13 18:07:21terry.reedycreate