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
#4
Personally, I'm glad python doesn't let you modify builtin types. Javascript has that, and it makes reading through some libraries/frameworks quite painful, since you don't really know if they're using the standard Array.slice, or if Array.slice never existed and they added it, or if they just replaced the builtin Array.slice with their own custom version.

Especially since there's nothing string specific about this particular case. "begins" could just as easily apply to any iterable such as lists.

And also it's just a one-line function, really makes me glad it can't be augmented to all strings.

tl;dr: I'm glad this isn't valid: str.begins = lambda s, args: any(s.startswith(substr) for substr in args)
Reply


Messages In This Thread
RE: what i repeatedly keeping wanting in Python - by nilamo - Apr-29-2019, 07:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  So I came to know this forum wanting to learn python MurphysLaw 0 1,499 Oct-21-2020, 10:06 AM
Last Post: MurphysLaw
  Keeping in shape as an Engineer sisoj 4 2,783 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