Coding Grace at GDG's Google Women TechMakers
By Vicky Twomey-Lee in Dublin March 26, 2014, midnight
That was a whirlwind of a ride yesterday evening. After being bedazzled by the newer looking Google building, we arrived just in time to set up, wave and say quick hello to Ursula (who was giving the Intro to HTML5 that evening) and settled down for a short presentation by Raphael followed by me (Vicky) about Coding Grace.
Here are the presentation slides. The upcoming events can be found on Slide #5.
I proceeded on to the training room, great setup. We had WiFi, power source for each participant, projector that works, mics, and what I like most, the twin LCD tvs overhead in front of me so I can see what others can see via the projector.
There were a couple of beginner programmers, but most were curious about Python. I was glad to have Mick with me to push the class along as I was wary of the beginners and not to bore the programmers.
- new string formatting that was ported back from 3 to 2, see http://docs.python.org/2/library/string.html#format-string-syntax
- Triple double-quotes are the same as triple single quotes
- Recommended Python editor: PyCharm IDE
(I personally use Sublime Text Editor with a terminal)
One of the main questions was to use Python 2 or 3. A re-cap that most major libraries have been ported to Python 3, however, there are lots of third party libraries that haven’t, but you can generally fork that code (normally on github or bitbucket) and patch it yourself on your own branch. A wee pain, but that’s if you want to use Python 3.
Here’s a bit of reading about it, as I said, it’s an age-old question:
And if you want to find out about porting from Python 2 to 3:
I do highly suggest use pip and virtualenv.
virtualenv is like sandbox, once you activate the virtual environment, you can install and play with libraries to your hearts content without mangling your system libraries. You can create Python 2 or a Python 3 virtual environments, which is great when trying out new libraries, or when development on projects using various versions of Python.
(Note: the latest release is virtualenv 1.11.4, be careful with reading the installation, they use 1.X.X)
Once you have virtualenv installed, you will have pip bundled with it as well.
What do you use Python for?
I have used it for small scripts to help me out in mundane tasks to websites to writing web apps.
Easier to show then list more:
Python has its own built-in unit test framework called unittest:
An alternative and nicer testing tool to use is pytest:
- 4 spaces for a tab. Some nice IDEs allow you to set up a tab and convert it to 4 spaces.
- When declaring variables, space them out. It’s more for readability.
- Naming conventions can be found in PEP 8 as well, mainly lowercase with underscores.
- (Optional) Max characters per line is 80, but to be honest, it’s down to you and if that makes the code unreadable, don’t do it.
- Readability: http://legacy.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds
But do have a read through PEP 8 for best programming style and practices. The bone of contention for me when working on team projects has to be the inconsistencies with spaces for indentation. So make sure everyone on the team agrees what is the best practice to avoid future grievances in code reviews. :-)
I want to thank all those who came along to the workshop, apologies for boring some of ye (still chuckling after pulling up someone’s variable and printing out “bored guy”). It is a chance for people to ask questions, the workshop revolves in interaction between participants and mentors, and it’s not a conventional training workshop.
I want to thank Raphael for inviting me, and GDG & Google for running and host the event, Mick and Ursula for running the workshops. It was still enjoyable on my end, and I still learn something new with each experience mentoring as each group is so unique and different.
Us mentors had a couple of pints afterwards and brainstormed on how we can run more fun-filled workshops, and we have tapped an idea that will be announced in the coming weeks.
Coding Grace is always on the look out for volunteer mentors (Python, Ruby/RoR, functional programmers, opendata, game designers/artists/devs, web designers/developers and more).
We are also on the look out for fun ideas to base topics on as well, and we run workshops based on demand.
How to find out more:
Questions? Email: firstname.lastname@example.org