2

While reading the book 'Learning Python' by 'Mark Lutz', I came about a chapter which discusses about 'dir' function and explained it with the example of:

dir([])

The explanation goes like this: 'The result includes a set of attributes that are related to the implementation of 'list' type... (some text). For instance, there are 45 list attributes but only 11 corresponds to named methods'.

As far as I know 'atributes' are variables related to an Object of a Class and 'Methods' are the functions of a class. So, in above line methods are mixed with attributes. Aren't both are different? In the given line what is the difference between 'Attributes' and 'Named Methods'?

Anurag Gupta
  • 31
  • 1
  • 6

0 Answers0