According to this following thread
How to differentiate between classes, functions, and methods
snake_case
for functions and methods to determine if it's specific type.
I was looking at string
module and I did print(dir(string))
and got all these
[Formatter
, Template
, _ChainMap
, _TemplateMetaclass
, __all__
, __builtins__
, __cached__
, __doc__
, __file__
, __loader__
, __name__
, __package__
, __spec__
, _re
, _sentinel_dict
, _string
, ascii_letters
, ascii_lowercase
, ascii_uppercase
, capwords
, digits
, hexdigits
, octdigits
, printable
, punctuation
, whitespace
]
I was just trying to get a range of alphabets using string.ascii_lowercase
but is not ascii_lowercase
a method
according to the link mentioned above? and a method
needs to be called as ascii_lowercase()
. but it is not working , is their a clear way to distinguish what is what?
I am confused here , someone please help me out.
Edit 1:
Just to be more clear on my question, an instance
does usually have attributes
and methods
and even method
is considered as an attribute
to an instance
, so this is where confusion arises for me.