Re: Memory usage in Python?
Alternatively, python provide a set of methods in classes called dunder methods. Those methods allow you to override operators of your classes. In this case, you'd want to override the equals operator and do something like the following:
class map:
def __init__(self, name):
self.name = name
# __eq__ is used to override the equals operator
def __eq__(self, other):
return self.name == other.name or self.name == other
By doing this you can directly compare a map with an other map, or a string object with the map. So instead of doing m.name == name you could do m == name
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector