-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Timestamp methods #17876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
4. is not locale safe (and less general); imagine returning month names for example |
Yah, definitely all super-low priority. Not sure about your numbering scheme, except for 4. locale-safeness would be a good reason for the status-quo, but the current version also hard-codes English names. In a quick %timeit comparison, using a dict lookup is ~3x faster. |
@jbrockmendel fixed the numbering (sometimes it is a bit annoying that you can write whathever number in markdown and it fixes it for you :-)) |
Related enough:
|
Fair enough. Changing 1 without changing 2 is liable to cause headaches down the road, so I'm going to mentally mark these as "wont fix" |
Two more:
|
Updated numbering scheme above. 1-4 have been answered. 5) will be actionable if I get the go-ahead. |
should probably work, I think if we can de-couple NaT from datetime/timedelta directly (but make it act like duck), then a few things will be easier |
can you update top section with check boxes as needed (then can reference the closing PR). |
Just ported this list above over to the TODO list in #17652; this can be closed if you want to de-clutter the tracker. |
[ ] -
Timestamp
classmethods should returncls
, not hard-codedTimestamp
[ ] - ... if and only if
is_timestamp
is updated to recognized subclasses.[ ] -
Timestamp._get_field
does not need to be in the user-facing namespace[x] -
Timestamp._get_named_field
does not need to be in the user-facing namespace[ ] -
Timestamp._get_start_end_field
does not need to be in the user-facing namespace[ ] -
NaT / timedelta
should behave likeNaT / Timedelta
#17955[ ] -
_assert_tzawareness_compat
doesn't actually return the declared return type[ ] - Is it the case that
_localize_tso
argumentobj
will always haveobj.tzinfo == None
? This is the case in all existing usages.A few quick questions:
__new__
returnsTimestamp
instead ofcls
. Is this intentional? DittoTimestamp.replace
returningTimestamp
instead ofself.__class__
.create_timestamp_from_ts
a classmethod. Maybe this function was written before cython supported cdef classmethods?Similarly,
is_timestamp
will miss subclasses ofTimestamp
. That is appreciably faster thanisinstance(obj, Timestamp)
, so this may just be something we have to live with.Some Timestamp methods are
cpdef
but may not need to be user-facing, i.e. could just becdef
:_get_field
,_get_named_field
,_get_start_end_field
Timestamp._get_named_field
is only used once, forweekday_name
. This callswhich seems like huge overkill for
return {0: 'Monday', ..., 6: 'Sunday'}[self.weekday()]
. Was there a decision at some point that the latter is less performant?The text was updated successfully, but these errors were encountered: