Python Forum
what i repeatedly keeping wanting in Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what i repeatedly keeping wanting in Python
#1
many times i encounter uses for this one capability i wish Python had. i guess this is because of encountering other programming languages in the past that could do something like this. of course, our view of things today is influenced by what we have seen in the past.

what i would like to have in Python is the ability to add new methods to builtin classes like int and str. and this would be a change to the class referenced as its class by every existing object even though these objects created before this change to the class. so if i add a new method to str after i have many str instances, the change applies to them all. same for all other builtin classes.

instead, i end up creating functions that need to have the object passed to it, which means checking the type of the passed data in the one function. with this method add-on feature there would be specific methods for each class, elimination a lot of testing.

Python is flexible. this would make it more flexible.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
what i repeatedly keeping wanting in Python - by Skaperen - Apr-27-2019, 06:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  So I came to know this forum wanting to learn python MurphysLaw 0 1,490 Oct-21-2020, 10:06 AM
Last Post: MurphysLaw
  Keeping in shape as an Engineer sisoj 4 2,754 Mar-09-2020, 08:06 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020