An object is an instance (or not)?

Ethan Furman ethan at stoneleaf.us
Tue Jan 27 15:36:29 EST 2015


On 01/27/2015 12:12 PM, Mario Figueiredo wrote:
>
> Because, from my own study of Python, I've came to realize that the 
> distinction between objects and instances of objects actually exists. In 
> Python, class objects cannot participate in OOP, only their instances. 

I haven't followed the other thread.  Can you give an example of this?  Because I have a counter-example ready:  the new
Enum data type, which uses a metaclass to treat the class just like any other instance of a normal class:

  list(MyEnum)  # fails on a regular class

  for enum in MyEnum: # fails on a regular class

  MyEnum['EnumName']  # fails on a regular class

--
~Ethan~

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20150127/f9793e46/attachment.sig>


More information about the Python-list mailing list