Skip to content

delattr: use python code to add back missing builtin from cpython? #1251

Closed
@TG-Techie

Description

@TG-Techie

dear developers,
I am a huge fan of cp and am loving using it!

please hear me out:
was making a program loader and bufferer for my gui/user_thing by making classes and after asking around why I was having a problem Dan Halbert pointed out that delattr isn't in cp.

however with Mr.Halbert's help and a pile of dead bugs, I mean debugs :-), I found this works:
def delattr(target,name): exec('del str_target.'+name, {'str_target':target})
and am using it

and if you check the cpython page about builtin functions it says:
"For example, delattr(x, 'foobar') is equivalent to del x.foobar."
see: https://docs.python.org/3/library/functions.html#delattr

I would love to investigate implementing this at a c level or a python level!? (if small size # of bytes)
is that "kosher" to ask to do?
if it is okay for my to try this can i ask where the builtins are? I looked through repo but could not find it. in tools? (also tried finding getattr, search did not yield its location)

thanks for considering it!,
~TG-Techie

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions