GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — learngit/dongwu.py at master · gitfengri/learngit

Expand file tree

/

dongwu.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
79 lines (71 loc) · 1.84 KB
/

dongwu.py

Copy path

File metadata and controls

79 lines (71 loc) · 1.84 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
class Chain(object):
def __init__(self,path=''):
self._path=path
def __getattr__(self,path):
return Chain('%s/%s' %(self._path,path))
def __str__(self):
return self._path
class Fib(object):
def __init__(self):
self.a,self.b=0,1
def __iter__(self):
return self
def next(self):
self.a,self.b=self.b,self.a+self.b
if self.a>10000:
raise StopIteration();
return self.a
def __getitem__(self,n):
if isinstance(n,int):
a,b=1,1
for x in range(n):
a,b=b,a+b
return a
if isinstance(n,slice):
start=n.start
stop=n.stop
a,b=1,1
l=[]
for x in range(stop):
if x>=start:
l.append(a)
a,b=b,a+b
return l
def __getattr__(self,attr):
if attr=='age':
return lambda:25
class Animal(object):
def run(self):
print 'I can run!'
def __len__(self):
return 100
class Dog(Animal):
def run(self):
print 'Dog can running!'
def shout(selft):
print 'Dog can shout!'
class Cat(Animal):
pass
class MyObject(object):
def __init__(self):
self.x=9
def power(self):
return self.x*self.x
class Student(object):
@property
def score(self):
return self._score
@score.setter
def score(self,score):
if isinstance(score,int):
if score<0 or score>100:
raise ValueError('score must between 0~100')
else:
self._score=score
else:
raise ValueError('score must be intger!')
class Person(object):
def __init__(self,name):
self.name=name
def __str__(self):
return 'Person object(name:%s)' % self.name
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.