[Edu-sig] K-16 CS/math hybrid
Kirby Urner
urnerk at qwest.net
Tue May 10 05:40:16 CEST 2005
> Bottom line, I hear from the "Python community" when confronted with some
> aspect of Python that allows one more freedom to shoot oneself in the foot
> that than do many other languages that, of course, Python has been
> designed for "consenting adults".
Right. If I write a class method starting with a single under bar, it's
sort of a tacit (consenting adult) agreement that neither you nor I will
call it directly from outside the class i.e. by writing object._foo(arg).
I could further protect this method with a double under bar, which is kind
of an emphatic "don't touch." But as a Python coder, you'd still know how
to call it directly:
>>> class Foo:
def __bar(self, arg):
print arg
>>> obj = Foo()
>>> obj._Foo__bar('duh!")
duh!
Indeed, dir() obligingly tells me the mangled name of my "private" method:
>>> dir(obj)
['_Foo__bar', '__doc__', '__module__']
Now if this were Java, we'd mark method bar as private and be done with it.
Any attempt to call it directly would net a *compile time* error. You'd be
doing something illegal, whereas in Python you're merely violating a strong
convention.
> With the concurrent thread that it is easy enough for children.
>
Children understand about conventions. I draw an invisible line on the car
seat: sister stays on her side, I stay on mine. But there's no electric
fence (much as we might wish there to be). Java provides electric fences.
Python provides lines in the sand. Children know the difference.
> Define "useful". Yes, I do think if that question is being asked, its
> pretty much game over.
>
> Approaching programming in any near serious way is sitting at a restaurant
> with no prices on the menu. And if you have to ask...
>
> Art
I don't really understand your attitude at this point (that's not a note of
disagreement, but of confusion, aka incomprehension).
Analogy (offered to help us clarify attitudes):
When cars were still newfangled, early adopters tended to be car nuts. They
knew a lot about fixing cars, their internals, especially as they tended to
break down a lot. A "driver" was likely a car geek, a pro. Then cars got a
lot easier to deal with, and all kinds of people learned to drive, yet
relatively few are pros, plus pros come in many shapes and sizes:
chauffeurs, race car drivers, truck drivers... with many subcategories
within these categories.
When computers were still newfangled, programmers tended to be computer
nuts. They knew a lot about computer internals and a programmer was likely
a computer geek, a pro. Then computers got a lot easier to deal with and
all kinds of people learned to program, yet relatively few are pros etc.
Python is a manifestation of programming becoming easier, more accessible.
It's still hard, as activities go, but think how many hours kids put into
skateboarding and/or snowboarding tricks. There's a teen around the corner
working on such skills. I encounter him several times a week, working out
with his skateboard. Is Python harder than that? Hard to quantify.
Useful: say I've ripped 1,000 CDs to MP3 but wasn't on the internet at the
time and so didn't have access to a CDDB. Now I do, and using artist and
album (recorded as folder names) my hope is to post hoc populate my MP3
files with song titles and play times.
Is this doable with Python? I don't actually know. I know there're
bindings to MP3 files, but is album name and artist sufficient to do a CDDB
lookup? Time to google [1]. I empathize with the kid who wants to
investigate and solve this problem -- and who perhaps succeeds, but
currently has no interest in becoming a "professional programmer."
Kirby
[1] Initial research:
I see I can do this in Perl:
http://www.perl.com/pub/a/2003/10/03/musicbrainz.html
Here's something I might start with in Python:
http://www.python.org/pypi/python-musicbrainz/0.10
Or if I'm gen-too:
http://www.gentoo-portage.com/dev-python/python-musicbrainz
And hey, I just learned about TRM fingerprinting. I hadn't realized this
was available: http://www.relatable.com/
More information about the Edu-sig
mailing list