Correct but misleading documentation

Bug #1435182 reported by Eric O LEBIGOT (EOL) on 2015-03-23
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pytz
Undecided
Unassigned

Bug Description

The documentation gives the following example:

>>> datetime(2002, 10, 27, 12, 0, 0, tzinfo=amsterdam).strftime(fmt)
'2002-10-27 12:00:00 LMT+0020'

The problem is that I was working on a difficult project for which I needed time zone support, so I quickly skimmed through the example code, found the line above, and then happily imported it into my program.

I am sure that I am not the only one who got caught by this. One prominent example is a recent blog entry *which specifically talks about time zones* and only quotes the incorrect way of doing things (https://www.airpair.com/python/posts/top-mistakes-python-big-data-analytics#4-mistake-3-not-understanding-time-and-timezones), as if it were a fundamental problem with pytz.

So, I strongly suggest that the documentation contains *a clear warning* around the example that should *not* be followed (bold, special paragraph type,…).

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers