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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

selfless-0.0.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

selfless-0.0.3-py2-none-any.whl (5.8 kB view details)

Uploaded Python 2

File details

Details for the file selfless-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for selfless-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 240aea6106aed4bb7bc2c922dd8aca1ec2e517fc7334e7721b769130175b2778
MD5 dbcf100bf0134493567ae335593d651a
BLAKE2b-256 31a40143f49fbd6b866a0bbb105b52009b26b5237bf1026e78bfa788613fd29d

See more details on using hashes here.

File details

Details for the file selfless-0.0.3-py2-none-any.whl.

File metadata

File hashes

Hashes for selfless-0.0.3-py2-none-any.whl
Algorithm Hash digest
SHA256 c31b4a9fcb454dfd85a3ec035101712506aaf53ed85b650cb582f06729c5ef4e
MD5 0c2ac3c62daca822494830b6480940e6
BLAKE2b-256 cbfdd503615ec0c7f76ab3820913ed7377d82a3de567dce1b64b42d640e707bb

See more details on using hashes here.

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