Basic class used as a SuperClass for other classes
Project description
# sclass
Simple module that allows you to create classes with the concept of Private and Public attributes and methods.
Just create your own class inheriting from sclass. Private methods are recognized by the first character of the attribute being ‘_’
` from sclass import sclass
- class Test(sclass):
- def __init__(self):
self.name = “lorenzo” self._surname = “bartolini”
- def publicmethod(self):
return ‘Public’
- def _privatemethod(self):
return ‘private’
x = Test()
print(x.name) print(x.publicmethod()) print(x._surname) print(x._privatemethod()) `
Last two instructions will raise a custom exception: PrivateException
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sclass-1.0.0.tar.gz
(6.1 kB
view hashes)
Built Distribution
sclass-1.0.0-py3-none-any.whl
(2.8 kB
view hashes)