[Tutor] How to know the internal execution flow of class
Mats Wichmann
mats at wichmann.us
Mon Feb 17 19:04:23 EST 2020
On 2/16/20 3:17 AM, Deepak Dixit wrote:
> Thanks Mats, I am agree with *Tim Peters *statement but I don't want to
> be one who know to write programs only. I am curious to know the
> internals of python :)
> BTW, Thanks for your well explanation, it helps me a lot to understand,
> specially __call__. Is there anything happening also when we are
> defining a *function* like the class ? One question regarding type, see
> this script-
>
> # Python 2.7.16 on Linux
>
>>>> type(dict)
> <type 'type'>
>>>> type(type)
> <type 'type'>
>>>> type(object)
> <type 'type'>
>>>>
>
> Here I am getting *type(type) = <type 'type'> * which confuses me. Is
> there any relation between 'type' and base/parent class of any
> object? what is the benefit of 'type' for a programmer?
I was busy and hoping someone else would pick up this advanced topic,
where there's a risk of saying something that isn't quite right.
Maybe as a next step read here?
https://docs.python.org/3/reference/datamodel.html
and for the topic that started this:
https://docs.python.org/3/reference/datamodel.html#metaclasses
can't say I've memorized it, perhaps I'll read again.
Also some interesting stuff here:
https://docs.python.org/3/library/types.html
More information about the Tutor
mailing list