Skip to content
/ Also Public

Ever had a lot methods do the same thing? Guess not.. but for those rare occasions..

Notifications You must be signed in to change notification settings

doboy/Also

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Also

Python utility module offering syntax sugar.

Background

Ever had lots of methods that do the same thing?! You want to set them to the same thing but dont want to do something lame like

   def method(self):
       pass

   othermethod = method

Rather you want to do it with style like

   @also('othermethod')
   def method(self):
       pass

Then do I have a solution for you!

Installation

pip install also

Usage

from also import also, AlsoMetaClass

class Foo:
    __metaclass__ = AlsoMetaClass

    @also('getThing')
    @also('get_thing')
    def getthing(self):
        return 'go bears'

foo = Foo()
assert (foo.getthing() == foo.get_thing() == 
        foo.getThing() == 'go bears')

About

Ever had a lot methods do the same thing? Guess not.. but for those rare occasions..

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages