Eureka moments in Python

Jarek Zgoda jzgoda at o2.usun.pl
Fri Mar 16 11:05:35 EDT 2007


Ben Finney napisał(a):

>> I'd be interested in hearing people's stories of Eureka moments in
>> Python, moments where you suddenly realise that some task which
>> seemed like it would be hard work was easy with Python.
> 
> I don't recall the exact context, but Python was the language that
> introduced me to the power of a unified type system.
> 
> The application I was writing was doing a whole lot of bookkeeping of
> information about what kind of data was being processed, which had to
> be kept updated in parallel with the data itself. Once I realised that
> "unified type system" and "first-class objects" meant that I could
> simply store the *type itself* as data, whether a basic type or one of
> my own, things became astoundingly easier. Soon after that I learned
> that functions are also objects, and I was hooked.

This was exactly the same "eureka" in my case too -- functions are
objects. I can store in a tuple the function and its arguments, then the
only thing I have to do is to call first element with the rest of
elements as arguments. This code now scares people in my former job --
being Java and C++ heads they just cann't get it... ;)

-- 
Jarek Zgoda

"We read Knuth so you don't have to."



More information about the Python-list mailing list