[Tutor] Why lambda could be considered evil

Ibraheem Umaru-Mohammed iumarumo@eidosnet.co.uk
Thu, 29 Aug 2002 12:59:19 +0100


["Erik Price"="Erik"]
Erik >> 
Erik >> On Wednesday, August 28, 2002, at 07:35  PM, Scot W. Stevenson wrote:
Erik >> 
Erik >> >>If you ever get round to reading
Erik >> >>up on lambda calculus then great, you can use python
Erik >> >>to play games without having to learn Lisp or Haskell...
Erik >> >
Erik >> >I think I'll save that one for a while - I still have the re module to 
Erik >> >get
Erik >> >thru =8).
Erik >> 
Erik >> That module is a sort of simlink on my system, to the "sre" module.  
Erik >> (Or the "pre" module if I were to uncomment one of the lines.)
Erik >> 
Erik >> Can someone explain why the code imports both from * and from "__all__" 
Erik >> ?  I've never seen the import __all__ before.  (It looks like this:
Erik >> 
Erik >> if engine == "sre":
Erik >>     # New unicode-aware engine
Erik >>     from sre import *
Erik >>     from sre import __all__
Erik >> else:
Erik >>     # Old 1.5.2 engine.  This one supports 8-bit strings only,
Erik >>     # and will be removed in 2.0 final.
Erik >>     from pre import *
Erik >>     from pre import __all__
Erik >> 
Erik >> thank you)
Erik >> 
Erik >> 
Erik >> Erik
Erik >> 

I believe this is because "from foo import *" doesn't work very well on
case sensitive platforms such as Windows. That is, "FOO.PY" could be
imported as module "foo", "Foo", or "FOO". I think the "__all__" is used
as a way to explicitly index names of a package. I've seen it used in a
package's __init__.py code, to list module names that should be imported
when "from foo import *" is used.

Kindest regards,

				--ibz.

-- 
				Ibraheem Umaru-Mohammed 
					"ibz"
			umarumohammed (at) btinternet (dot) com