In Python is it bad to create an attribute called ‘id’?

That’s ok, and is pretty common. For example, objects mapped to a database record will often have an “id” attribute mapped to the database “id” column value.

Attributes are always “namespaced” so you have to refer to them via self.id or obj.id so there’s no conflict with the built-in function.

Leave a Comment

techhipbettruvabetnorabahisbahis forumu