-
Recent Posts
- Workaround for flask/babel/sphinx bug on Python 3+
- enum in Python
- Python Decorators
- Unicode – the basics
- Python’s magic methods
- Gotcha — Mutable default arguments
- Unicode for dummies — Encoding
- How to post source code on WordPress
- Python3 pickling
- Yet Another Lambda Tutorial
- Read-Ahead and Python Generators
- In Java, what is the difference between an abstract class and an interface?
- Newline conversion in Python 3
- Why import star is a bad idea
- Learning Subversion: the mystery of .svn
- How to fix a programmable Northgate keyboard
- Northgate keyboard repair
- An alternative to string interpolation
- A Globals Module pattern
- An Arguments Container pattern
- A Globals Class pattern for Python
- How to open a web browser from Python
- Command-line syntax: some basic concepts
- Unicode for dummies – just use UTF-8
- Unicode Beginners Introduction for Dummies Made Simple
- Multiple constructors in a Python class
- How do I reverse a string in Python 3?
- What’s wrong with use cases?
- Python Packages
- Diagram arrangements
- Python & Java: A Side-by-Side Comparison
- Static vs. dynamic typing of programming languages
- Debugging in Python
- Introduction to Python Decorators
- Gotcha — forgetting parentheses
- Gotcha — backslashes in Windows filenames
- Gotcha — backslashes are escape characters
- Python Gotchas
Categories
- Decorators (2)
- Java and Python (3)
- Keyboards (2)
- Miscellaneous (2)
- Moving to Python 3 (3)
- Python & JSD (1)
- Python debugger (1)
- Python features (9)
- Python Globals (3)
- Python gotchas (5)
- Software Development (2)
- Subversion (1)
- Unicode (4)
Category Archives: Python features
Workaround for flask/babel/sphinx bug on Python 3+
I’m using Python 3.4 on Windows. Recently I tried to install and use Sphinx. When I did, I encountered an error that ended with the string an integer is required (got type str) Googling that string, I found an explanation … Continue reading
Posted in Python features
Comments Off on Workaround for flask/babel/sphinx bug on Python 3+
enum in Python
Recently I was reading a post by Eli Bendersky (one of my favorite bloggers) and I ran across a sentence in which Eli says “It’s a shame Python still doesn’t have a functional enum type, isn’t it?” The comment startled … Continue reading
Posted in Python features
8 Comments
Python’s magic methods
Here are some links to documentation of Python’s magic methods, aka special methods, aka “dunder” (double underscore) methods. Rafe Kettler’s A Guide to Python’s Magic Methods ::—> http://www.rafekettler.com/magicmethods.html Michael Foord’s chapter on Python Magic Methods from this book IronPython in … Continue reading
Posted in Python features
2 Comments
Yet Another Lambda Tutorial
There are a lot of tutorials[1] for Python’s lambda out there. A very helpful one is Mike Driscoll’s discussion of lambda on the Mouse vs Python blog. Mike’s discussion is excellent: clear, straight-forward, with useful illustrative examples. It helped me … Continue reading
Posted in Python features
17 Comments
Why import star is a bad idea
When I was learning Python, I of course read the usual warnings. They told me: You can do from something_or_other import * but don’t do it. Importing star (asterisk, everything) is a Python Worst Practice. Don’t “import star”! But I … Continue reading
Posted in Python features
11 Comments
An alternative to string interpolation
I sort of like this. # ugly msg = “I found %s files in %s directories” % (filecount,foldercount) # better def Str(*args): return “”.join(str(x) for x in args) : : msg = Str(“I found “, filecount, ” files in “, … Continue reading
Posted in Python features
15 Comments
How to open a web browser from Python
This goes under the Tips and Tricks category. Also under Stuff I wish I had known about a long time ago. The trick is in the standard library, in the webbrowser module. “”” For documentation of the webbrowser module, see … Continue reading
Posted in Python features
4 Comments
Multiple constructors in a Python class
In addition to working with Python, I also work with Java quite a lot. When coding in Python, I occasionally encounter situations in which I wish I could code multiple constructors (with different signatures) for a class, the way you can … Continue reading
Posted in Python features
6 Comments
Python Packages
I’ve avoided putting my Python modules into packages. That’s because (like a lot of other folks) I don’t really understand how to create a package. And that’s because (probably like a lot of other folks) I’m too time-constrained and over-worked … Continue reading
Posted in Python features
6 Comments