On Apr 3, 2007, at 1:56 PM, Sales Info wrote:

> I'm trying to like Python. Haven't had my "aha" moment yet. Plan on
> downloading the latest Dabo release soon and giving it another try.

        I second Ted's comment that Dabo is not the way to learn Python. You  
will get so much more out of Dabo if you already know Python.

        My 'aha' moment with Python came when I was lamenting the fact that,  
well, it just wasn't Fox, and we all know how awesome Fox is,  
especially with data. Python just didn't have cursors that I could  
manipulate like I could in Fox.

        The first part of the 'aha' was when I realized that a Python  
dictionary mapped perfectly to a record in a table. That is, a dict  
is a collection of values that you access by their keys, while a  
record is a collection of values that you access by their column  
names. So a Python dict whose keys are the column names, and whose  
values are the column values is the same thing.

        The second part of the 'aha' was when I made the connection that a  
cursor in VFP is nothing more than a series of records with identical  
structures, and that if I created a series of Python dicts with  
identical structures, that would do the same thing. Python has two  
ordered sequence types: lists and tuples. The differences are not  
relevant here, but suffice it to say that a VFP cursor can be  
represented in Python as a list of dicts.

        Python, and other interpreted languages (like Fox, for that matter)  
have a largely undeserved reputation for being slow, but one place  
that Python is highly optimized is in the area of lists, tuples and  
dictionaries - they are wicked fast in practice. This meant that I  
could manipulate my Python 'cursors' with the same confidence as I  
could in Fox. That's what convinced me that Python was the way to go.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to