Python Forum
can functions know/learn who they are?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can functions know/learn who they are?
#3
passing the name is what i am doing now. i'm wanting to make all of these work just like real functions so that instead of:
    do_request('foobar','blah')
i can do:
    foobar('blah')
i do not have the list of names until run time. if i code a call that turns out not to be in the list, it should fail like any other attempt to call a function that does not exist.

the botocore library does something similar. it creates an object in which it adds a bunch of functions as attributes so you end up with a call like:
    object.associate_vpc_cidr_block(**options)
if i could do this with attributes on one object that would be nearly as good.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: can functions know/learn who they are? - by Skaperen - May-04-2019, 12:14 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020