Why PyLadies?

pyladies_blue

Hey Hacker News! If you’re coming here for the first time, you may also be interested in What I mean when I say I would like more women in the software industry

PyLadies is a group of women working on welcoming, encouraging and directly inviting women to join the Python community and to learn from each other.

I started a PyLadies chapter in Portland, OR last September (2012). We started out with weekly meetings to do homework from a Coursera class to make games with Python. That turned into weekly meetings — plus homework meetups on Saturdays at a local coffee shop, and IRC hangout time to test homework. And that turned into me giving mini-lessons at each Coursera meetup about the material from the class.

People seemed really excited.

Stats - PyLadies PDX (Portland, OR) - Meetup

Before we knew it, it was December, we had over 60 women subscribed to the Meetup, 30 of which had attended a meeting. Today, we’ve got 96 subscribers, 50 people have attended a meeting, and more have signed up to attend events in the future than ever before. And, it’s done by women. Using open source. Teaching classes. Learning developer tools. And writing software.

Since September, I’ve met even more women involved in running PyLadies chapters across the country. Much like the way the PostgreSQL community is organized, we’ve got a loosely connected group of people working independently. We offer support to each other, but don’t have hard and fast rules about what each chapter does. We encourage teaching and workshops, but don’t require them. We share our resources and are quick to put git repos out there of our materials. We send lots of pull requests. And we’re constantly looking for ways for women to get more involved in open source and Python.

All Group Reviews - PyLadies PDX (Portland, OR) - Meetup

I’m completely energized by the positive feedback we’ve gotten for every meeting. More recently, I’ve heard from people that they feel confident and sure of their knowledge because they’ve spent time in our meetups talking and learning from other women.

My goal is to make every get together like that – by having great lessons, a shared understanding of coaching and peer-based education and presentations from our members. Building these groups takes time, and I’m impatient to get to the part where I feel like every interaction with the group is rewarding for every member.

And I can’t do it alone. We’ve got four meetup organizers (although one is about to relocate to the Bay Area!). I work closely with Flora Worley, a kickass developer who chose programming as a career path after working on a PhD, on topic details and planning for the meetings. I’m so looking forward to meeting in person with the many members of the PyLadies community at PyCon next month.

Learning python the hard way: print vs sys.write, and python -u

I knew before that print in Python had some weird properties. Like:

>>> for i in [1, 2, 3, 4]:
... print "blah"
...
blah
blah
blah
blah
>>> for i in [1, 2, 3, 4]:
... print "blah",
...
blah blah blah blah

One thing you’ll notice is that there’s a space between each of the blahs. If you don’t want those spaces, you need to use sys.write. Here’s an example of using sys.write along with a progress bar indicator. Which is exactly what I wanted this for.

Finally, you can indicate to python on the command-line that you want unbuffered stdin and stdout with python -u.

Learning Python the hard way: __init__.py needed for packages (as opposed to modules)

Just ran into this today, and wanted to get it down so I never forget:

Modules are not packages! 🙂

From the docs, a Module is:

A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended. Within a module, the module’s name (as a string) is available as the value of the global variable __name__.

And a Package is:

Packages are a way of structuring Python’s module namespace by using “dotted module names”.

When you create a module and you want other scripts to be able to reference it, you need an __init__.py in the directory containing the modules in order for Python to treat a directory as containing a package.

The error manifests as “ImportError: No module named XXXX”.

All I had to do was touch __init__.py and things worked. I’m sure there are other things I’m going to learn today, but that was a silly one that I didn’t expect, and wasn’t mentioned in the Modules documentation, but is mentioned in Packages.