Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What was the project that made you feel skilled in Python?

108 views
Skip to first unread message

Ned Batchelder

unread,
May 19, 2013, 7:30:49 AM5/19/13
to pytho...@python.org
Hi all, I'm trying to come up with more project ideas for intermediate
learners, somewhat along the lines of
http://bit.ly/intermediate-python-projects .

So here's a question for people who remember coming up from beginner: as
you moved from exercises like those in Learn Python the Hard Way, up to
your own self-guided work on small projects, what project were you
working on that made you feel independent and skilled? What program
first felt like your own work rather than an exercise the teacher had
assigned?

I don't want anything too large, but big enough that there's room for
design, and multiple approaches, etc.

Thanks in advance!

--Ned.

Chris Angelico

unread,
May 19, 2013, 7:48:58 AM5/19/13
to pytho...@python.org
Easy answer from me: The Yosemite project. And the code still looks
like a n00b wrote it. (On that subject: Pull requests welcome.)

The code is here: https://github.com/Rosuav/Yosemite

I wrote it in Python because I wanted to be able to run it on either
the Windows box that drives our TV system, or the Linux box that
actually stores the content. And it's still doing that, quite nicely.

Yosemite is a pretty simple system. It's broadly similar to a classic
file-serving web server, but instead of making files available for
download, it invokes them locally. There are plenty of other ways to
achieve this, and I'm by no means sure I picked the best, but that's
where it's at, and it was my first real Python project that's been
published.

ChrisA

Roy Smith

unread,
May 19, 2013, 10:05:28 AM5/19/13
to
In article <mailman.1844.1368963...@python.org>,
Ned Batchelder <n...@nedbatchelder.com> wrote:

> So here's a question for people who remember coming up from beginner: as
> you moved from exercises like those in Learn Python the Hard Way, up to
> your own self-guided work on small projects, what project were you
> working on that made you feel independent and skilled? What program
> first felt like your own work rather than an exercise the teacher had
> assigned?

IIRC, my first production python projects were a bunch of file parsers.
We had a bunch of text file formats that we worked with often. I wrote
some state-machine based parsers which slurped them up and gave back the
contents in some useful data structure.

Many of the files were big, so I added an option to write out a pickled
version of the data. The parsing code could then check to see if there
was a pickle file that was newer than the text version and read that
instead. Big win for speed.

Then, of course, a bunch of utilities which used this data to do useful
things. I remember one of the utilities that turned out to be really
popular was a smart data file differ. You feed it two files and it
would tell you how they differed (in a way that was more useful than a
plain text-based diff).

Neil Cerutti

unread,
May 20, 2013, 11:16:55 AM5/20/13
to
I wrote a library supporting fixed length field tabular data
files. It supports reading specifications for such data files
using configparser for maximum verbosity, plus a few other
shorthand specification formats for brevity. Due to the nature of
my work I need this library in virtually all my other projects,
so I consider it a personal success and found it interesting to
build.

Similar packages on PYPI made many different design decisions
from the ones I did, so it seems like fruitful design discussion
points could arise.

For example, two major design goals in the beginning where: 1.
Ape the interface of the csv module as much as possible. 2.
Support type declarations.

The former was a big success. I've had instances were switching
from csv to a fixed file required changing one line, and of
course if a person were learning the library their knowledge of
reader, writer, DictReader and DictWriter would help.

The latter design goal was a failure. Most published fixed-length
data file specifications include data types, so it seemed
natural. But after trying to write programs using an early
version I ended up removing all traces of that functionality.

One advantage of this idea as a project for an intermediate
programmer is that the implementation is not complicated; most of
the fun is in the design.

--
Neil Cerutti

Demian Brecht

unread,
May 20, 2013, 3:20:21 PM5/20/13
to Ned Batchelder, Python
TBH, I think that the first thing that I did that made me feel that I
could hold my own was when I had my first (and only thus far) patch
accepted into the stdlib. To me, there's a /big/ difference between
throwing together a package that a few people may find useful and
putting a patch together that's accepted by a particular module expert
and committed to the stdlib.

To intermediate learners, I would strongly advocate getting their
hands dirty with some part of the stdlib. Really (imho), there's
really no better place to learn. Yes, in whole, it's a large project,
but there are quite a few small(er) modules that, once their
environment is set up, are self-contained and easy to follow along.
Even if they don't get anything committed, learning from Python
experts is far more useful than any other path that I've personally
taken.

Having said that, another great learning experience for me was when I
wrote my OAuth 2.0 client (https://github.com/demianbrecht/sanction)
and brought the initial implementation (460'ish LoC) to 66 LoC
(pre-2/3 support). In part, this was due to taking a different design
approach, but it was also in part due to taking advantage of Python
idioms rather than simply using approaches that I had used in other
languages.

On Sun, May 19, 2013 at 4:30 AM, Ned Batchelder <n...@nedbatchelder.com> wrote:
> Hi all, I'm trying to come up with more project ideas for intermediate
> learners, somewhat along the lines of
> http://bit.ly/intermediate-python-projects .
>
> So here's a question for people who remember coming up from beginner: as you
> moved from exercises like those in Learn Python the Hard Way, up to your own
> self-guided work on small projects, what project were you working on that
> made you feel independent and skilled? What program first felt like your
> own work rather than an exercise the teacher had assigned?
>
> I don't want anything too large, but big enough that there's room for
> design, and multiple approaches, etc.
>
> Thanks in advance!
>
> --Ned.
> --
> http://mail.python.org/mailman/listinfo/python-list



--
Demian Brecht
http://demianbrecht.github.com

Thomas Murphy

unread,
May 20, 2013, 3:36:09 PM5/20/13
to Demian Brecht, Python
Hi Demian,

Can I ask what you mean by working through the stdlib? As in writing
code pieces utilizing each module from the stdlib? Also, you're
talking about "patches" in the stdlib? Is there a separate library of
patches? Forgive me if I'm google-failing hard over here.

Terry Jan Reedy

unread,
May 20, 2013, 4:03:05 PM5/20/13
to pytho...@python.org
On 5/20/2013 3:36 PM, Thomas Murphy wrote:
>
> talking about "patches" in the stdlib? Is there a separate library of
> patches?

http://bugs.python.org
http://docs.python.org/devguide/



Ben Finney

unread,
May 22, 2013, 9:05:58 AM5/22/13
to pytho...@python.org
Ned Batchelder <n...@nedbatchelder.com> writes:

> as you moved from exercises like those in Learn Python the Hard Way,
> up to your own self-guided work on small projects, what project were
> you working on that made you feel independent and skilled? What
> program first felt like your own work rather than an exercise the
> teacher had assigned?

I wanted to simulate a particular board game, and had others in mind
with some common mechanics.

This resulted in a library for rolling dice in different combinations,
and looking up result tables <URL:https://pypi.python.org/pypi/alea>.

Eventually I wanted to extend it to know about custom decks of cards,
and the different ways those are handled in board games.

The unifying theme was a library of routines for simulating the random
elements (dice, cards, tables, spinners, etc.) in any board game.

A little over-engineered, I'll freely admit. But it did give me a sense
of being at home in Python and knowing that this is a good language for
getting things done the right way.

--
\ “Creativity can be a social contribution, but only in so far as |
`\ society is free to use the results.” —Richard Stallman |
_o__) |
Ben Finney

Chris Angelico

unread,
May 22, 2013, 10:43:23 AM5/22/13
to pytho...@python.org
On Wed, May 22, 2013 at 11:05 PM, Ben Finney <ben+p...@benfinney.id.au> wrote:
> I wanted to simulate a particular board game, and had others in mind
> with some common mechanics.
>
> This resulted in a library for rolling dice in different combinations,
> and looking up result tables <URL:https://pypi.python.org/pypi/alea>.

Fun fun! Of course, when I hear "rolling dice in different
combinations", my mind immediately turns to Dungeons and Dragons,
where it's plausible to roll d20+7, then roll 2d8+d6+12 to figure out
how much damage you did...

But the hard part of board games is usually the board. I used to spend
ages trying to draw up a half-decent board, and ended up giving up. By
"simulate", I'm guessing you mean that you didn't actually draw
anything of the sort?

ChrisA

Terry Jan Reedy

unread,
May 22, 2013, 3:52:14 PM5/22/13
to pytho...@python.org
On 5/22/2013 9:05 AM, Ben Finney wrote:

> I wanted to simulate a particular board game, and had others in mind
> with some common mechanics.
>
> This resulted in a library for rolling dice in different combinations,
> and looking up result tables <URL:https://pypi.python.org/pypi/alea>.

Have you cosidered adding a description so it can be found be a search?
A 3.3 version?

"Simulate game randomizers and lookup: dice rolls, card drawing,
spinners, ...

Ben Finney

unread,
May 23, 2013, 7:32:38 PM5/23/13
to pytho...@python.org
Chris Angelico <ros...@gmail.com> writes:

> Ben Finney <ben+p...@benfinney.id.au> wrote:
> > This resulted in a library for rolling dice in different
> > combinations, and looking up result tables
> > <URL:https://pypi.python.org/pypi/alea>.
>
> Fun fun! Of course, when I hear "rolling dice in different
> combinations", my mind immediately turns to Dungeons and Dragons,
> where it's plausible to roll d20+7, then roll 2d8+d6+12 to figure out
> how much damage you did...

Yeah, and lots of board games use custom dice with faces specific to
that game (symbols, non-consecutive numbers, etc.), so the Die class
allows the faces to be any object the application needs.

> But the hard part of board games is usually the board.

A lot of the board games I'm intrigued by don't have much of a board;
they use custom cards and tokens and (maybe) dice, and the “board” is an
abstraction of where all the pieces are on the table.

> I used to spend ages trying to draw up a half-decent board, and ended
> up giving up. By "simulate", I'm guessing you mean that you didn't
> actually draw anything of the sort?

Right. The (never completed) application was to simulate the mechanics
of that particular game so I could see how it would play out, not be an
interactive playable game.

I've long been aware there is an enormous amount of UI-programming work
involved with interactive playable games. My ambition for that work was
quenched from attempting it in my teenage years :-)

--
\ “With Lisp or Forth, a master programmer has unlimited power |
`\ and expressiveness. With Python, even a regular guy can reach |
_o__) for the stars.” —Raymond Hettinger |
Ben Finney

Nicholas Cole

unread,
May 25, 2013, 4:17:08 AM5/25/13
to pytho...@python.org
On Sun, May 19, 2013 at 12:30 PM, Ned Batchelder <n...@nedbatchelder.com> wrote:
Hi all, I'm trying to come up with more project ideas for intermediate learners, somewhat along the lines of http://bit.ly/intermediate-python-projects .

So here's a question for people who remember coming up from beginner: as you moved from exercises like those in Learn Python the Hard Way, up to your own self-guided work on small projects, what project were you working on that made you feel independent and skilled?  What program first felt like your own work rather than an exercise the teacher had assigned?

I had been doing some part-time work on server administration while I was a graduate student, and had written a python library to help display user-interfaces for some of the scripts we used internally.  At some point, I discovered that as I had originally written it, I was triggering a small memory leak, caused by the interaction between python and the underlying curses c library.  In the real world, it would never have mattered, but I minded very much that the problem existed at all.

To fix the fault required rewriting the whole library from scratch, and I did the initial version of this while on a long train journey away from internet access.  I could have just left it -- for the scripts we were running it didn't matter at all -- but it was a matter of pride to write code that didn't behave badly, even in theory.

I ended up putting the code online, and 8 years and a huge number of public releases later it still seems to be useful to a few people, and I've learned an awful lot doing it.  I think my proudest "python" moment was when I first got a bug report from someone I didn't know.


Best wishes,

N.

Mark Janssen

unread,
May 26, 2013, 12:28:24 AM5/26/13
to Nicholas Cole, pytho...@python.org
Building a Set class (this was before python had them built-in). Such
exercise stimulates thinking on designing objects that could be part
of the standard library, the questions that arise on API design,
questions on efficiency of implementation.

Then a graph class which can be built from your newly-built set module.

Mark
Tacoma, Washington

On 5/25/13, Nicholas Cole <nichol...@gmail.com> wrote:
> On Sun, May 19, 2013 at 12:30 PM, Ned Batchelder
> <n...@nedbatchelder.com>wrote:
>
>> Hi all, I'm trying to come up with more project ideas for intermediate
>> learners, somewhat along the lines of http://bit.ly/intermediate-**
>> python-projects <http://bit.ly/intermediate-python-projects> .
--
MarkJ
Tacoma, Washington
0 new messages