Skip to main content

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.

Metadata

Release files for selfless 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for selfless 0.0.3
File Interpreter ABI Platform
selfless-0.0.3-py3-none-any.whl Python 3 none any Details
selfless-0.0.3-py2-none-any.whl Python 2 none any Details

Total release size: 10.3 kB

Release files / selfless-0.0.3-py3-none-any.whl

Download URL selfless-0.0.3-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
240aea6106aed4bb7bc2c922dd8aca1ec2e517fc7334e7721b769130175b2778
BLAKE2b-256 checksum
How to use checksums
31a40143f49fbd6b866a0bbb105b52009b26b5237bf1026e78bfa788613fd29d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / selfless-0.0.3-py2-none-any.whl

Download URL selfless-0.0.3-py2-none-any.whl
Size 5.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
c31b4a9fcb454dfd85a3ec035101712506aaf53ed85b650cb582f06729c5ef4e
BLAKE2b-256 checksum
How to use checksums
cbfdd503615ec0c7f76ab3820913ed7377d82a3de567dce1b64b42d640e707bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page