Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
byte types
#8
you're talking more about how things like len() are implemented, which is not something that matters to the programmer (nor should it) while i am talking about how the API design affects the programmer and how she goes about using that design to make use of the facility it describes. if Python did not have a len() function and it had to be user implemented, would you want there to be different function call names depending on the datatype the caller wants to get the length of? i would not. i would describe the API before any implementation is done (although there might be design changes after testing has a test implementation done and it is then discovered that the API design had flaws that needed to be changed or additions would be helpful). consider the clen() function i described in my previous post. what if Python was going to include it in the language? its implementation might well be like how len() is done, calling the __clen__() method in each specific type. but what if, before this, it had been decided to have different names for different types lik lclen() for lists, tclen() for tuples, and baclen() for bytearrays? would you expect to see the name changed because of the way it is implemented? i would not. and this is why i would just call it clen() to begin with.

i do have a couple of functions in my function collection that have type varying names. but their names are based on what type is returned ... bachr() to return one bytearray character from its code number ... and bchr() for bytes type. both accept int as the one argument.

dynamic typing as a language feature seems to be rather lost in Python due to a lot of people effectively saying not to use it. for me, it is one of the great features of Python.
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
byte types - by Skaperen - Oct-31-2018, 10:44 PM
RE: byte types - by wavic - Nov-01-2018, 05:03 AM
RE: byte types - by Gribouillis - Nov-01-2018, 09:18 AM
RE: byte types - by Skaperen - Nov-01-2018, 06:22 PM
RE: byte types - by Gribouillis - Nov-01-2018, 08:08 PM
RE: byte types - by Skaperen - Nov-02-2018, 12:05 AM
RE: byte types - by Gribouillis - Nov-02-2018, 05:45 AM
RE: byte types - by Skaperen - Nov-02-2018, 02:48 PM
RE: byte types - by wavic - Nov-02-2018, 06:06 PM
RE: byte types - by Skaperen - Nov-04-2018, 09:32 PM
RE: byte types - by ichabod801 - Nov-05-2018, 02:24 AM
RE: byte types - by Skaperen - Nov-06-2018, 12:55 AM
RE: byte types - by wavic - Nov-05-2018, 07:58 AM
RE: byte types - by Gribouillis - Nov-06-2018, 08:01 AM
RE: byte types - by Skaperen - Nov-07-2018, 04:03 AM
RE: byte types - by Gribouillis - Nov-07-2018, 09:19 PM
RE: byte types - by Skaperen - Nov-07-2018, 09:26 PM

Forum Jump:

User Panel Messages

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