On Wed, May 2, 2018 at 12:22 PM, C W <tmrs...@gmail.com> wrote: > It's interesting how mean() can be implemented, but median() will break > other packages. > > So, the default way in numpy is to use functions, not methods? > > When I first learned Python, I was told to create an object and to play > around, there are methods for that object. List has list methods, tuple has > tuple methods, etc. > > Now, the default way in numpy is to use function instead of methods? I'm > confused. What happened to object-oriented programming?
Even outside of numpy, a lot of Python uses functions, not methods. One good reason for this is that a function can accept a wide variety of data types as its argument; for instance, len() accepts many things, not just lists. Some things are done with methods, others with stand-alone functions. There are design choices each way. ChrisA -- https://mail.python.org/mailman/listinfo/python-list