[issue12750] add cross-platform support for %s strftime-format code

2018-07-05 Thread Paul Ganssle


Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue12750] add cross-platform support for %s strftime-format code

2018-03-02 Thread Adam Williamson

Adam Williamson  added the comment:

On the "attractive nuisance" angle: I just ran right into this problem, and 
reported https://bugs.python.org/issue32988 .

As I suggested there, if Python doesn't try to fix this, I'd suggest it should 
at least *explicitly document* that using %s is unsupported and dangerous in 
more than one way (might not work on all platforms, does not do what it should 
for 'aware' datetimes on platforms where it *does* work). I think explicitly 
telling people NOT to use it would be better than just not mentioning it. At 
least for me, when I saw real code using it and that the docs just didn't 
mention it, my initial thought was "I guess it must be OK, and the docs just 
missed it out for some reason". If I'd gone to the docs and seen an explicit 
note that it's not supported and doesn't work right, that would've been much 
clearer and I wouldn't have had to figure that out for myself :)

For Python 2, btw, the arrow library might be a suitable alternative to 
suggest: you can do something like this, assuming you have an aware datetime 
object called 'awaredate' you want to get the timestamp for:

import arrow
ts = arrow.get(awaredate).timestamp

and it does the right thing.

--
nosy: +adamwill

___
Python tracker 

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



[issue12750] add cross-platform support for %s strftime-format code

2016-07-15 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Given that we have the .timestamp() method, I am not sure this would be a very 
useful feature, but maybe it is a way to eliminate an attractive nuisance.

If anyone is still interested in getting this in - please check with 
python-ideas.

--
title: datetime.strftime('%s') should respect tzinfo -> add cross-platform 
support for %s strftime-format code

___
Python tracker 

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