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__

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

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

python functools vs Haskell

Python’s functools module is not the same as functional programming in haskell. The module does provide some sample or taste of functional programming tools, but if you import that module and try to write Haskell syntax, God help you…… you are going to write haskell syntax and expect the python interpreter to behave like haskell ghci.

Just did a removal of all the lines written for DEBUG information in my program and now i feel like an ass………
Damn there were 100 lines, while my overall class was 600  lines(including around 50-100 lines of getter and setter functions) Damn there is got to be a better way to do this………
I need to start writing test scripts, instead of DEBUG……..
That way atleast the test scripts can be reused…………