Assigning IDs to instances of a class (Pythonic)

Posted by mellort on Stack Overflow See other posts from Stack Overflow or by mellort
Published on 2010-06-07T13:23:43Z Indexed on 2010/06/07 13:32 UTC
Read the original article Hit count: 194

Filed under:

I want to have each instance of some class have a unique integer identifier based on the order that I create them, starting with (say) 0. In Java, I could do this with a static class variable. I know I can emulate the same sort of behavior with Python, but what would be the most 'Pythonic' way to do this?

Thanks

© Stack Overflow or respective owner

Related posts about python