姬長信(Redy)

方法和函数之间的区别,在Python中与C相比


我正在使用Code Academy的Python教程,我对方法和函数的定义有点困惑.从教程:

You already know about some of the built-in functions we’ve used on (or to create) strings, such as .upper(), .lower(), str(), and len().

来自C,我认为.upper()和.lower()将被称为方法和len()和str()函数.在本教程中,这些术语似乎可以互换使用.

Python以C的方式区分方法和函数吗?

Difference between a method and a function不同,我问的是Python的细节.术语“方法”和“功能”似乎并不总是遵循链接问题的已接受答案中给出的定义.