how to get names of attributes

Chris Angelico rosuav at gmail.com
Wed Dec 30 07:50:03 EST 2015


On Wed, Dec 30, 2015 at 11:40 PM, Charles T. Smith
<cts.private.yahoo at gmail.com> wrote:
> Oh!
>
> Although the referenced doc says:
>
>   "For compatibility reasons, classes are still old-style by default."
>
> is it true that dictionaries are by default always new-style objects?
>
>   (PDB)c6 = { "abc" : 123, "def" : 456}
>
>   (PDB)isinstance (c6, dict)
>   True
>
>   (PDB)isinstance (c6, object)
>   True

I believe that's true, yes. The meaning of "by default" there is that
"class X: pass" will make an old-style class. All built-in types are
now new-style classes.

ChrisA



More information about the Python-list mailing list