Python is fun (useless social thread) ;-)

M

Max M

bruno said:
Well, I haven't be really impressed the first time - note that it was at
the very end of the last century, with v1.5.2.


1.5.2 was an excellent version. Not really that different in use than
current version.


--

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science

Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
 
B

bruno at modulix

Max said:
1.5.2 was an excellent version. Not really that different in use than
current version.

Nope, "not really that different" - we were just missing list-comps,
generators, new-style classes, classmethods, staticmethods, usable
metaclasses, descriptors, @decorators sugar, extended slices, and a few
other goodies coming in 2.5 like coroutines and with: statement...
 
M

Max M

bruno said:
Nope, "not really that different" - we were just missing list-comps,
generators, new-style classes, classmethods, staticmethods, usable
metaclasses, descriptors, @decorators sugar, extended slices, and a few
other goodies coming in 2.5 like coroutines and with: statement...


I wrote "different in use". Which is not the same as saying it has not
changed. The general feel of coding in Python is exactly the same to me.

I believe that most of those changes you mention are rarely used by most
programmers.


--

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science

Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
 
B

bruno at modulix

Max said:
I wrote "different in use".

Yes. It just happens that all this really changed a lot the way I use
Python (and the way I design and program in general).
Which is not the same as saying it has not
changed. The general feel of coding in Python is exactly the same to me.

AFAIC, the overall feeling that the language helps me instead of getting
in the way is still here, of course !-)
I believe that most of those changes you mention are rarely used by most
programmers.

Too bad for them then. Not that I use all of these nice features all the
time, but I have a use case for at least one of them almost everyday -
and I do miss them when using other languages.
 
B

BartlebyScrivener

You know what are dicts, right ? That is, containers with
You bet. I have lots of these. Especially a large dictionary that is
kind of an application and site launcher. I type "l clp" at the command
line, and l.py runs a function def launch(obj), which grabs the key
"clp" whose value is this site address, and I'm browsing clp. Kind of
like favorites with no mouse. Or another dictionary with applications.
Same way. They work fine. I guess they aren't complex enough to require
classes yet?

I appreciate the tips. I'll do a couple tutorials and read my books and
then come back with any OO questions.

Thanks Bruno and Luis.

rd
 
T

Terry Hancock

John said:
Did you have to learn it for a job?

No, for me, programming is primarily a hobby. I worked on scientific
programming in Fortran in the 1980s and in C in the 1990s. Later I
did some sys admin work, and managed to use a bit of Python in that.
Or did you just like what you saw and decided to learn it for fun?

I became interested in creating a free software graphic adventure
game, and we needed a scripting language. A collaborator heavily
favored Python, and so I checked it out.

I was a stay-at-home Dad at the time, so I had time to work on
projects. But I also had to juggle kids. So a programming language
like C that required me to "hold a lot of state in my head" was
unworkable. When you're watching kids, you have maybe 5-10
minutes between interruptions, so you need to be able to
recover your place in seconds. Python makes that more
possible than any other language I've seen.

At first I was suspicious of the significant whitespace. But I
quickly realized the brilliance of it -- it makes the computer queue
on the same thing my eyes use to recognize code-blocks, so it's
virtually impossible to have an ambiguous code-block bug.

In fact, I was stunned at how many common bugs you just can't
have happen in Python (of course, later on I discovered a few that
it specifically enables, but well, there's no such thing as a perfect
solution).
Also, how did you go about learning it? (i.e., like I described
above, I started with the main stuff then moved on to the different
available frameworks)

I picked up a copy of Learning Python from O'Reilly books. I went
through it in three days -- easily record-breaking time for me to
learn a new computer language. Of course, I didn't learn *everything*
in that time, but I learned enough to write useful stuff in it. That
sold me on it -- it was obviously the right language for me to be
using.
Was there any necessity in the specifics you learned, or did you just
dabble in something (e.g. wxPython) for fun?

Well, as I said, I started on a game project. Later on, I spent a lot
of time using Zope and working on a big-concept CMS design. I think
I was way out of my depth actually. I'm considering extending Plone
to do what I need, now, but I haven't really had a chance to look
at it.
Are there still some things you feel you need to learn or improve?

Of course!

* I am working on combining auto-generated documentation with
pre-written overview documentation to get the 'best of both worlds'
documentation for the code.

* I am trying to better understand and use testing methodologies. Testing
is hard to get in the habit of doing, because it requires forethought --
testing is work you do now, during early development, that saves you
tons of time later on, when you are supporting and improving the
software. So it's requires some discipline to spend that extra up-front
time (even though you know it's going to save you later).

* There will always be modules you don't know yet (and more are being
written). In particular, I'm looking into installing and extending
Plone.
I also need to learn more about XML processing and other stuff I'm
going to need for processing vector graphics.

* I still haven't totally gotten my head around GUIs, nor PyGame (which
is back to the game project) though I'm getting closer to my goals.

Regrettably, though, it's still a hobby, and I have less time even than
I used to. Even though I still stay at home, I have a full time writing
workload now, and it's become a little difficult to find enough time
for programming. Once again, though, Python's ease of readability
really helps me to pick up where I left off when I have to do that (which
is a lot).

Cheers,
Terry
 
B

Bruno Desthuilliers

BartlebyScrivener said:

No big deal. Using dicts to organize data is quite obvious, and then you
need to operate on these data, so you write functions using these dicts...
I have lots of these.
Especially a large dictionary that is
kind of an application and site launcher. I type "l clp" at the command
line, and l.py runs a function def launch(obj), which grabs the key
"clp" whose value is this site address, and I'm browsing clp. Kind of
like favorites with no mouse. Or another dictionary with applications.
Same way. They work fine. I guess they aren't complex enough to require
classes yet?

Nothing really *requires* classes if you go that way. Now going from
dicts+functions to classes+methods is quite a no-brainer, and can really
ease maintenance. Once you'll be there, you'll probably find yourself
shifting to a more OO style (small decoupled methods, polymorphic
dispatch etc) swithout even noticing. You don't have to learn all the
voodoo stuff about OO to start using OO in Python - but if you already
made the move from strictly procedural (dicts/lists/tuples + functions)
to ADTs (simplest use of classes), you'll be happy to have the whole
power of Python's object model when the need arise.
I appreciate the tips. I'll do a couple tutorials and read my books and
then come back with any OO questions.

You're welcome. FWIW, a good exercice would be to take one of your own
programs and try to gradually transform dicts+related funcs to classes.

My 2 cents
 
A

AdSR

John said:
Did you have to learn it for a job?

No, although it became useful once I learnt it.
Or did you just like what you saw and decided to learn it for fun?

I saw Bruce Eckel mention it in "Thinking in Java, 2nd ed." as
"something that was slowly becoming his favorite programming language".
How would *you* react to that? :)
Also, how did you go about learning it? (i.e., like I described above, I
started with the main stuff then moved on to the different available
frameworks)

I started with the tutorial, although I didn't read it end-to-end. Then
I toyed a little with DB API (MySQLdb). It came useful some two weeks
after installing Python, when I was doing some DB refactoring in the
(Java) app I was working on at the time. Compared to JDBC, Python DB
API is very lightweight, which also taught me how not to overdesign.

Later I learnt Tkinter when I wrote a tool for some admin tasks on that
DB. I was to lazy to do it in Java.
Was there any necessity in the specifics you learned, or did you just
dabble in something (e.g. wxPython) for fun?

See above.
Are there still some things you feel you need to learn or improve?

Metaclasses and other magic, if I ever need that stuff. Otherwise,
design and algorithms - these are not Python-specific, but Python can
be a useful learning tool here.
Additional comments/complains here: :)

Every XML API for Python that I tried sucks in one way or another. Try
manipulating a document with multiple namespaces, you'll know. Not that
I ever saw any XML API in any language that would do everything I
expected from it correctly. Ergo, XML sucks. :)

Cheers,

AdSR
 
B

BartlebyScrivener

You know what are dicts, right ? That is, containers with keyword-access
to values ? Then you probably have dicts with a known, defined
structure, and functions working on it. What classes (and hence 00)
gives you is a way to associate these functions with the dicts
themselves. That is the big intuition about objects, the rest is just
details.

Bruno,

Ever seen this from Fuzzyman? It explicitly uses the dict comparison.

http://www.voidspace.org.uk/python/articles/OOP.shtml#introduction

Thanks for the tip,

rd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top