python interpreter vs lisp interpreter

I recently remember reading python is not similar enough to lisp, because the intrepreter doesn’t give you the internal data structure but strings. While this was a theoretical idea at the moment ran across today.

>>>from django_auth_ldap.config import LDAPSearch

I am basically poking around this django_auth_ldap module to figure out how to get it to work with my django app. right now it’s throwing an operation error: need to perform bind before this operation(cn lookup).

Here i import this class and test some functionality of this django_auth_ldap module and see how it works for me..

At this point, am sick of searching for the error message on google and getting meaningless results that don’t solve my problem..Also nobody currently on the #django irc channel seem to know or are interested.

Time to Read the source. Ok let me see where’s the codebase in my unix directory structure..(Yeah, i don’t follow one single way of getting packages installed, just do whatever works.. i know bad practice yada yada… but hey, am lazy and haven’t crossed the tipping point to find this behaviour more work than the recommended best practice :-))

>>> LDAPSearch.__file__
Traceback (most recent call last):
File "", line 1, in
AttributeError: type object 'LDAPSearch' has no attribute '__file__'

Uh.. oh LDAPSearch is a class not a module

>>> help(LDAPSearch)

>>> LDAPSearch.__module__
'django_auth_ldap.config'

Ok, i can get the module using this let me see… if i can get the file from it too.

>>>LDAPSearch.__module__.__file__
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'str' object has no attribute '__file__'

Oh.. crap… the .__module__ returns a string and not a module object.. If only..

Well.. this probably won’t work.. still it’s only a couple of keystrokes away… No point trusting when you can test easily(empircist)

>>> eval(LDAPSearch.__module__).__file__
Traceback (most recent call last):
File "", line 1, in
File "", line 1, in
NameError: name 'django_auth_ldap' is not defined
>>>

Ah…. now i want python to be more like lisp*… i don’t want just the module name as string i want the module object to be accessible….

*– even though i don’t know lisp :-P

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s