-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: add some properties to Timestamp #46761
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Are there plans to only expose day_some_thing
or daysomething
? Bit weird to have both/a mix of them.
for instance, from a much earlier PR both from #1723 (comment)
Save any toing and froing in the future I think we could probably leave |
@property | ||
def days_in_month(self) -> int: ... | ||
@property | ||
def daysinmonth(self) -> int: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in stubs could these be defined as aliases or do they need to be declared separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have to be declared separately in stubs, because the type checkers won't see that it is a property if you put the alias in the stubs.
If that's the case, then we shouldn't document them either. IMHO, if we document it, we should include it in the stubs, which is why I added them in the stubs. |
could perhaps consider removing from documentation too. I may be wrong here, but I was under the impression that pylance uses the stubs for a better user experience with code completion? If this is the case, it may be better if the recommendations only include the recommended attributes and not the aliases allowed for backwards compatibility. we already in some of the overloads only include some parameters as keyword only even though these are not yet deprecated. do we know why the aliases are currently missing from the stub. Was it intentional? |
Doesn't that imply we are making the decision on deprecation?
pylance uses it for code completion and for type checking. mypy will use it for type checking, so that if a user used the "old" way (e.g.,
Probably an oversight. Looking at the first creation of |
That's what @jreback was asking in #37390 (comment). maybe we need a dedicated issue to seek consensus.
I think that's OK. nbd to add a type ignore if you don't want to clean up the code there and then. |
Created #46768 |
For typing, add for
Timestamp
:dayofweek
dayofyear
days_in_month
daysinmonth