Skip to main content

A small experimental module for implicit "self" support in Python (in some restricted contexts)

Project description

selfless

A small experimental, work-in-progress, module for implicit “self” support in Python (in some restricted contexts), targeting Python 2.7 (if possible) and 3.6+.

Documentation and explicit examples will be added when the module is more mature. This is used as a dependency for another module; when that module is made public, the existence of this module will be justified.

What is this?

If you don’t know, you probably don’t need it. It can be used as an example of AST transformer though.

In some contexts (this will be clarified in the future), writing and reading self. polutes the code and can be cumbersome. This module tries to alleviate that in some specific contexts.

How does it work?

This module inspects the source code of a class, extracts its AST and inserts self. for variables in a list (if provided) or variables not in the global and local contexts at the time of import.

Finally, the transformed AST is compiled and inserting into the original context of the class selfless was applied to.

I’m also trying to restrict the transform to the ``with`` keyword but it’s a work-in-progress.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for selfless, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size selfless-0.0.3-py2-none-any.whl (5.8 kB) File type Wheel Python version 2.7 Upload date Hashes View hashes
Filename, size selfless-0.0.3-py3-none-any.whl (4.4 kB) File type Wheel Python version 3.6 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page