Skip to main content

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


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)

Uploaded source

Built Distribution

sclass-1.0.0-py3-none-any.whl (2.8 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page