Do datetime objects need to be deep-copied?

Since all available types in the datetime module are documented as being immutable (right after the documentation of the classes it is stated):

Objects of these types are immutable.

you shouldn’t worry about this.

Operations on a datetime instance will return a new instance thereby not affecting any other names that refer to the previous one.

You might want to take a look at the link provided by PM 2Ring that explains facts and myths about how names and values work. That should shed some light on any confusions you have about names.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)