0

I expect this question risks being closed as opinion-based, but it is a genuine question, and I assume there is a technical answer.

The builtin functions len and type confuse me, because I keep wanting to write

x.len()

or even

x.len

instead of

len(x)

This is probably because I use numpy x.shape frequently, and I wondered what the rationale for this is? I assume it is something related to being dynamically typed, or maybe something related to None, but I couldn't figure it out. Are there certain situations where having these as members (properties or methods) doesn't make sense? Or maybe it is a speed consideration?

Sanjay Manohar
  • 6,920
  • 3
  • 35
  • 58

0 Answers0