Skip to content

Instantly share code, notes, and snippets.

@carlessanagustin
Last active April 5, 2016 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlessanagustin/c3c69747bc8d46af658ed8b12e1b9003 to your computer and use it in GitHub Desktop.
Save carlessanagustin/c3c69747bc8d46af658ed8b12e1b9003 to your computer and use it in GitHub Desktop.
Basic Python class skeleton from https://pypi.python.org/pypi/skeleton/
#!/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()
#!/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