Dave added the comment:
Thanks for the reply, STINNER Victor reply makes more sense in hindsight.
Legacy often rules and we can work with/around things knowing it's full
behavior.
Since this is not documented for datetime.now()(where this issue began), can we
add comments something like
R. David Murray added the comment:
No. As I said, datetime.now() returns a *datetime object*. Formatting only
becomes involved when you format an object, and that applies to *any* datetime
object, and is correctly documented in __str__ + isoformat.
Please do not reopen the issue again
Dave added the comment:
Ok, as a c++ guy, it looked like it's returning a string. The documentation
says Return the current local date and time, but it's actually returning a
datetime object (likely an object pointer) initialized to the current time. I
think this is where every class
R. David Murray added the comment:
You are correct. Effectively every class has an __str__, and that is what gets
called when you print something without specifying any other formatting. (I
say effectively, because if there is no __str__ the __repr__ gets used, which
every class *does* have
Dave added the comment:
I'll order it.
Thanks again,
Dave
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17139
___
___
Python-bugs-list
STINNER Victor added the comment:
I believe the datetime.now() should always return the same format.
It's now how it was implemented:
http://docs.python.org/dev/library/datetime.html#datetime.datetime.__str__
and
http://docs.python.org/dev/library/datetime.html#datetime.datetime.isoformat
New submission from Dave:
Calling datetime.datetime.now() will return only the Date and time to the
second w/o the decimal portion when the second increments when also running
firefox w/shockwave flash enabled on a windows 7 machine.
Example output:
counter1 is: 23360 time is: 2013-02-05
Mark Dickinson added the comment:
See also issue #1074462
--
nosy: +mark.dickinson
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17139
___
___
Mark Dickinson added the comment:
This is a feature request rather than a bug report; changing fields
accordingly.
Also, given the discussion leading to the rejection of issue 1074462, and the
fact that you can now use %f in strftime as an easy way to get consistent
output (issue 1158), I'm
Dave added the comment:
Point was/is that I'd be willing to fix this so that others don't have to.
It's for OTHERS SAKE that I submitted this issue as my system is already bullet
proof from this defect/lack of feature situation. This is also my first
attempt to get involved with the
Dave added the comment:
I appreciate you guys looking into this so quickly, but let's dig a little
deeper.
1. STINNER Victor, you claim this is already fixed in 3.4 by the link, however
this doesn't really help since I'm not even up to 3.3 yet (though I'm
considering it, I meant to select
R. David Murray added the comment:
I think Victor meant not instead of now.
It doesn't only occur when your run particular programs, it occurs whenever the
microseconds are zero. It is possible that your particular combination of
programs produces a timing pattern that means you see
Dave added the comment:
Thanks David Murry for clearing up STINNER Victor comments. I already feel
like I work here;) So it's not broke if there exists a workaround.
In that case it's time to update the documents (which often takes longer than
the code to update) to reflect this
R. David Murray added the comment:
No, it is not it's not broke because there's a workaround, it is not broken
because it is *working as designed*.
The str of any object in python is intended to be a convenient representation
of that object. Note that this applies to *all* objects in Python,
14 matches
Mail list logo