Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COHi. Thank you for your reply. One thing that confuses me about this is maybe you are expecting (and have written code to reflect this expectation) that if an object wants to get a user's ID, this would be done with a function called "getUserID()". And in your code, you introspect and look for this function called getUserID. Well, maybe the programmer prefers to name his functions "differently" and calls his function "retrieve_the_user_identification_integer()" or something wacky like that. This is what confuses me about on the fly introspection. It seems that you are assuming a lot.
      singulars
    2. COActually, yours is good doubt. You normally don't introspect on the objects created by you or your class. Because, you already know that something is present! Now, consider the cases where objects are **given** to you and you don't know much information about them, introspection is for those cases. Good example. You write a GUI Editor with Autocompletion, I use the editor and I create a custom module and object. When I try to auto-complete an object which I wrote, your editor should give me the list of possible functions. How will your editor know? By introspecting my objects. HTH.
      singulars
    3. COThe concept of "duck typing" is relevant here. If an object has a `write()` method, Python will be happy to let you use it anywhere you are trying to write a file -- regardless of whether it is derived from the `file` class. (This is very different from some other languages!) So if you are about to write to a file, you can either give it a whirl and see if you get an exception, or you can check to see if it has a `write()` method using `hasattr()` first. The usual Python idiom is in fact to try it and catch exceptions, but there are situations where "looking before you leap" is also useful.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload