Last active
April 5, 2016 14:04
-
-
Save carlessanagustin/c3c69747bc8d46af658ed8b12e1b9003 to your computer and use it in GitHub Desktop.
Basic Python class skeleton from https://pypi.python.org/pypi/skeleton/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Basic script to create an empty python package containing one module | |
""" | |
from skeleton import Skeleton, Var | |
class BasicModule(Skeleton): | |
""" | |
Create an empty module with its etup script and a README file. | |
""" | |
src = 'basic-module' | |
variables = [ | |
Var('module_name'), | |
Var('author'), | |
Var('author_email'), | |
] | |
def main(): | |
"""Basic command line bootstrap for the BasicModule Skeleton""" | |
BasicModule.cmd() | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
class Employee: | |
'Common base class for all employees' | |
empCount = 0 | |
def __init__(self, name, salary): | |
self.name = name | |
self.salary = salary | |
Employee.empCount += 1 | |
def displayCount(self): | |
print "Total Employee %d" % Employee.empCount | |
def displayEmployee(self): | |
print "Name : ", self.name, ", Salary: ", self.salary | |
"This would create first object of Employee class" | |
emp1 = Employee("Zara", 2000) | |
"This would create second object of Employee class" | |
emp2 = Employee("Manni", 5000) | |
emp1.displayEmployee() | |
emp2.displayEmployee() | |
print "Total Employee %d" % Employee.empCount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment