From: Lou Pecora on
In article
<1944d953-25ad-440b-9317-a7a4b4de6dac(a)f17g2000prh.googlegroups.com>,
Jonathan Gardner <jgardner(a)jonathangardner.net> wrote:

>
> I can explain all of Python in an hour; I doubt anyone will understand
> all of Python in an hour.
>
> Coming from perl to python, the big "aha!" moment was when I realized
> there wasn't anything more than what I saw before me. I kept expecting
> something big around the corner, kind of like when I first discovered
> refs in perl, or when I realized how hard it truly was to write OO
> code in perl that actually does what you think it should do.
>
> Perl has trained me to be fearful of the language, constantly on the
> lookout for jabberwockies. If you fall into one of those traps in
> perl, it's because you weren't smart enough and aren't worthy of the
> language, or so they say. It's never perl's fault. I mean, doesn't
> everyone know what the Schwartzian Transform is?
>
> Python is the complete opposite. Go through http://docs.python.org/reference/
> . Once you've familiarized yourself with all the operators,
> statements, and the special methods, you're done with syntax and the
> core language. There is no more.
>
> The next step is to learn the basic objects and functions in builtins.
> That's in the first seven chapters of
> http://docs.python.org/library/index.html.
> You can always fall back to the "help" function to remind yourself if
> you forget. I do it all the time.
>
> After that, it's merely figuring out which standard libraries do what
> and how. The documentation there is complete and awesome, and there
> are more than enough people willing to point you in the right
> direction here.
>
> There are no dragons in this forest. Heck, this isn't even a forest---
> it's a single-room apartment with everything you need right there
> where you can see it. The thermostat is set to room temperature, and
> no matter what happens outside, you're safe and protected from it all.


That's a pretty accurate description of how I transitioned to Python
from C and Fortran. I kept trying to think of how to output data and
parameter variables of different types to files for later reading in.
How to format them all consistently and then get them back in with the
exact same accuracy. I was stuck in printf and scanf land. Then after
much noodling around and reading it hit me that I could just put all
that output of different types of variables into a list, hit it with a
repr() function to get a string version, and write the string to a file
-- no formatting necessary-- three lines of code. Later reading in the
string version (no formatting necessary), and hitting it with an eval()
function returned all the values I originally had in those variables.
How simple, but beautiful. I was making it harder when Python was
making it easier. Trained on the wrong language.

--
-- Lou Pecora
From: John Bokma on
Jonathan Gardner <jgardner(a)jonathangardner.net> writes:

> On Feb 2, 9:11 pm, John Bokma <j...(a)castleamber.com> wrote:
>> Jonathan Gardner <jgard...(a)jonathangardner.net> writes:
>> > I can explain, in an hour, every single feature of the Python language
>> > to an experienced programmer, all the way up to metaclasses,
>>
>> Either you're a hell of a talker, or I am far, far away from being an
>> experienced programmer. It's advocacy like this, IMO, that keeps people
>> away from a language, because you can't feel nothing but a failure after
>> a statement like this.
>>
>
> I can explain all of Python in an hour;

OK, in that case I would say give it a go. Put it on YouTube, or write a
blog post about it (or post it here). I am sure you will help a lot of
people that way.

> Coming from perl to python, the big "aha!" moment was when I realized
> there wasn't anything more than what I saw before me. I kept expecting
> something big around the corner, kind of like when I first discovered
> refs in perl, or when I realized how hard it truly was to write OO
> code in perl that actually does what you think it should do.

There are very nice frameworks to help you (e.g. Moose). OO is not that
hard IMO, but I can imagine it's very hard if you don't understand
references sufficiently.

> Perl has trained me to be fearful of the language, constantly on the
> lookout for jabberwockies. If you fall into one of those traps in
> perl, it's because you weren't smart enough and aren't worthy of the
> language, or so they say.

Odd, you gave me the same feeling when you stated you could explain me
all features of Python in an hour.

> It's never perl's fault. I mean, doesn't everyone know what the
> Schwartzian Transform is?

Doesn't everyone know what the big O notation is? I mean, Schwartzian
transform is not unique to Perl, and it strikes me as odd that you think
it is. It's all about understanding that general sort on average is O(n
log n), and hence does O(n log n) comparisons. Which means that if you
do an expensive calculation in a custom compare function or do a lot of
comparisons it might be cheaper to do precalculate the keys
(O(n)). Randal Schwartz was the person who made this idea popular in the
Perl community, hence the Perl community named it after him, but it was
long known before that and used in other languages.

[How to learn Python]
I am fully aware of how to learn a language, I've done so several times
(or many times even). I only disagree with your statement that you can
explain all features of Python to me in an hour. But I love to be wrong
on this, and to stand corrected.

> There are no dragons in this forest. Heck, this isn't even a forest---
> it's a single-room apartment with everything you need right there
> where you can see it. The thermostat is set to room temperature, and
> no matter what happens outside, you're safe and protected from it all.

Why does this sound like some religious speech?

I always say: if there was a really easy to learn programming language,
I would be programming in it. And no, I don't think Python is it. (Nor
Perl for that matter). I do agree that Python /looks/ more simple (and
certainly cleaner, unless you're using regexp a lot) than Perl, and
certainly to some extend Python /is/ simpler. But in my (relatively long
experience) programming boils mostly down to which libraries you know,
and how well you can use them.

Finally, note that simpeler doesn't always make your code more easy to
grasp. There is a reason that human languages are rich and often have
many ways to say something. Programming, after all, is also
communication with other humans (if only with one self).

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
From: Paul Rubin on
Lou Pecora <pecora(a)anvil.nrl.navy.mil> writes:
> after much noodling around and reading it hit me that I could just put
> all that output of different types of variables into a list, hit it
> with a repr() function to get a string version, and write the string
> to a file -- no formatting necessary-- three lines of code. Later
> reading in the string version (no formatting necessary), and hitting
> it with an eval() function returned all the values I originally had in
> those variables. How simple, but beautiful.

FYI: I do that too sometimes, but in general using repr/eval that way
is poor style and not very reliable. It's better to use the pickle
module, which is intended for that sort of thing, or the json module
if your datatypes are suitable and you want to follow a semi-standard.
From: Steve Holden on
Robert Kern wrote:
> On 2010-02-03 15:32 PM, Jonathan Gardner wrote:
>
>> I can explain all of Python in an hour; I doubt anyone will understand
>> all of Python in an hour.
>
> With all respect, talking about a subject without a reasonable chance of
> your audience understanding the subject afterwards is not explaining.
> It's just exposition.
>
I agree. If the audience doesn't understand then you haven't explained it.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/

From: alex23 on
"Timothy N. Tsvetkov" <timothy.tsvet...(a)gmail.com> wrote:
> Jonathan Gardner <jgard...(a)jonathangardner.net>
> > Python is much, much cleaner. I don't know how anyone can honestly say
> > Ruby is cleaner than Python.
>
> I developed on both (Python was first) and I think that ruby I
> very clean and maybe cleaner than Python.
>
> And you're wrong with blocks.

You say 'static', and I say 'dynamic'.
You say 'consistent', and I say 'erratic'.
Static! Dynamic!
Consistent! Erratic!
Let's join the right news group.