Skip to content

Conversation

@nakagami
Copy link

@nakagami nakagami commented Nov 22, 2016

For more compatibility

@dpgeorge
Copy link
Member

A much simpler way to do this is to use a namedtuple.

@nakagami
Copy link
Author

Thanks, I did not know ucollections.namedtuple has implemented.

But tm_gmtoff and tm_zone is not memmbers of tuple.
So struct_time is not namedtuple, I think.

@pfalcon
Copy link
Contributor

pfalcon commented Sep 9, 2017

I implemented namedtuple solution in d69aaba. While tm_gmtoff and tm_zone fields are indeed not supported, those are novelty fields themselves, not available in "classical Python". And micropython-lib lacked attribute-style access for 3 years, hopefully we can sustain couple more years without those fields.

Usecases for adding them are certainly welcome. The triggering usercase for adding namedtuple solution was desire to minimize patching of CPython's datetime module test, and lack of attribute access accounted for quite a lot of patching there (there's still a bunch of patching left beyond that). And of course, just a background that many CPython apps use such attribute access (but it's still discouraged for native MicroPython apps of course).

@jimmo
Copy link
Member

jimmo commented Jul 21, 2023

Closing due to inactivity. As mentioned above, this could be re-implemented with namedtuple. Also this has moved to the unix-ffi directory.

@jimmo jimmo closed this Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants