and xeven though they are an option in the latter this and book sometimes label features as changes to contrast with traditional codebut some are technically introduced by new-style classes--which are mandated in xbut can show up in code too for spacethis distinction is called out often but not dogmatically here complicating this distinctionsome class-related changes owe to new-style classes ( skipping __getattr__ for operator methodsbut some do not ( replacing unbound methods with functionsmoreovermany programmers stick to classic classesignoring what they view as feature new-style classes are not newthoughand apply to both pythons--if they appear in codethey're required reading for users too attribute fetch for built-ins skips instances we introduced this new-style class change in sidebars in both and because of their impact on prior examples and topics in new-style classes (and hence all classes in )the generic instance attribute interception methods __get attr__ and __getattribute__ are no longer called by built-in operations for __x__ operator overloading method names--the search for such names begins at classesnot instances attributes accessed by explicit namehoweverare routed through these methodseven if they are __x__ names hencethis is primarily change to the behavior of built-in operations more formallyif class defines __getitem__ index overload method and is an instance of this classthen an index expression like [iis roughly equivalent to __geti tem__(ifor classic classesbut type(x__getitem__(xifor new-style classes--the latter beginning its search in the classand thus skipping __getattr__ step from the instance for an undefined name technicallythis method search for built-in operations like [iuses normal inheritance beginning at the class leveland inspects only the namespace dictionaries of all the classes from which derives-- distinction that can matter in the metaclass model we'll meet later in this and focus on in where classes may acquire behavior differently the instancehoweveris omitted by built-inssearch why the lookup changeyou can find formal rationales for this change elsewherethis book is disinclined to parrot justifications for change that breaks many working programs but this is imagined as both an optimization path and solution to seemingly obscure call pattern issue the former rationale is supported by the frequency of built-in operations if every +for examplerequires extra steps at the instanceit can degrade program speed --especially so given the new-style model' many attribute-level extensions new-style class changes