testnestedclass.py

来自「Python Development Environment (Python I」· Python 代码 · 共 26 行

PY
26
字号
class Rectangle(object):
    class Foo:
        def foo(self):
            class bla:
                print "foo"
            
            b = bla()
            print "foo nested class"
        
    
    a = Foo()
    a.foo()
    def __init__(self, width, height):
        self.width = width
        self.height = height
        self.color = "red"
        localBorder = "bold"
    
    def getArea(self):
        return self.width * self.height
    
    area = property(getArea, doc='area of the rectangle')

myRectangle = Rectangle(10, 15)
print myRectangle.width
print myRectangle.area

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?