Name mangling vs qualified access to class attributes

2016-12-13 Thread paolieri
The official Python tutorial at https://docs.python.org/3/tutorial/classes.html#private-variables says that "name mangling is helpful for letting subclasses override methods without breaking intraclass method calls" and makes an interesting example: class Mapping: def __init__(self, iterabl

Re: Name mangling vs qualified access to class attributes

2016-12-15 Thread Marco Paolieri
Hi all, Thank you for the feedback. So, to recap, reasons to use name mangling 'self.__update(iterable)' rather than qualified access 'Mapping.update(self, iterable)' are: 1. Qualified access stops working when class 'Mapping' is renamed (at compile-time) or its name is reassigned at runtime. H