
Django admin awesomeness - twampss
http://joshourisman.com/2009/10/15/django-admin-awesomeness/
======
RyanMcGreal
Whoa - you can put a class definition _inside_ a function definition?

~~~
seiji
That's tame. Here's a scary example [1] (redefining a (built in) function in
the middle of a running coroutine):

    
    
      def foo(x):
        yield len(x)
        yield len(x)
      >>> g = foo(range(5))
      >>> g.next()
      5
      >>> len = lambda y: 8
      >>> g.next()
      8
    

This causes problems when trying to implement an efficient python. You have to
re-lookup your function bindings every time.

[1]: Example taken from Colin's Unladen Swallow presentation
<http://llvm.org/devmtg/2009-10/Winter_UnladenSwallowLLVM.pdf>

~~~
dschobel
kind of aside, does python support real coroutines yet or is it still just
generators?

~~~
superjared
You should look at greenlet. Pretty cool stuff, used heavily in eventlet and
gevent.

