Difference between revisions of "Classes"

From wikieduonline
Jump to navigation Jump to search
 
(7 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
* [[Python]] https://docs.python.org/3/tutorial/classes.html
 
* [[Python]] https://docs.python.org/3/tutorial/classes.html
  <code>[[global]]</code>
+
  [[global]]
  <code>[[nonlocal]]</code>
+
  [[nonlocal]]
  
  
 
  class Dog:
 
  class Dog:
     kind = 'canine'        # class variable shared by all instances
+
     mykind = 'canine'        # class variable shared by all instances
 
     def __init__(self, name):
 
     def __init__(self, name):
 
         self.name = name    # instance variable unique to each instance
 
         self.name = name    # instance variable unique to each instance
  
 +
Empty class <code>MyEmployee</code>
 +
class MyEmployee:
 +
    pass
  
  
Line 16: Line 19:
 
* [[Methods]]
 
* [[Methods]]
 
* [[Inheritance]]
 
* [[Inheritance]]
 +
* [[Iterators]] https://docs.python.org/3/tutorial/classes.html#iterators
 +
* [[Generators]] https://docs.python.org/3/tutorial/classes.html#generators
  
 
== See also ==
 
== See also ==

Latest revision as of 17:57, 3 March 2022

Advertising: