The current Python (I do not know about Py3000) has some annoying features (annoying for me, not for you - you love them.)
How's this for counter-intuitive:
>>> a = ['f', 'a', 'i', 'l']
>>> a.join("")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'join'
>>> "".join(a)
'fail'
... the join method, to me, seems like it's in the wrong area. If I have an array (list), I want to join it together with a string. I don't want to get a string, then join it to an array.
More counter-intuitiveness:
>>> import re
>>> pat = re.compile('^\w\d+$')
>>> s = 'b45343'
>>> s.match(pat)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'match'
>>> pat.match(s)
<_sre.SRE_Match object at 0xb7c6e598>
... when programming and I have a string, I want to see if the string matches a pattern. I don't want to get a pattern and see if a string matches it. My suggestion could involve regex stuff being built into the string library - or not, depending on implementation. Either way is fine.
How about pypi, the place where Python packages live. Say I want a lib to do SSH, and don't know what the package is called. I ask pypi and I get a list including:
Contrast this to searching CPAN which is the place where Perl's libraries live. I get this:
CPAN is clearer.
Here's another thing: you can't do assignments in conditional tests. Observe:
>>> if (a = (1 + 1)): print "yay"
File "<stdin>", line 1
if (a = (1 + 1)): print "yay"
^
SyntaxError: invalid syntax
... compare to Perl:
$ perl -e 'if ($a = (1 + 1)) { print "yay\n" }'
yay
Django Python 960.gs Git Vim NetBSD Nginx
This is the blog of Brad Willis, a software engineer living in Brisbane.
Help
Latest entries
*BSD Agile Apache Apple apt Athletics Best-Practice Censorship Comedy Cool Crosswords Deployment Django English Exim Firefox Git Hardcore Health irssi Javascript Jira Languages Linux Makefile Mathematics Mobile Broadband Mutt MySQL NetBSD nginx Nokia OpenVZ OSX Perl Privacy Python Rant Requirements rsync Ruby Shell Slackware SQL SQLite SSH Standards Subversion Television Testing ThisBlog Vim VMWare (Fusion) VPN X zsh
Checking for exceptions in doctests
Homer's Curling Speech
retry in Python
Vim Makefile tabs
Centos (or RH) IPTables
Converting ssh2 public keys to openssh
Vim comment hints
Context managers in Perl
Dish rotation
Git - fixing commit user
apt stuff
Using shell variables in AWK
Linux - Too many open files
Tell gvim to save and quit... remotely
Vim - automatically remove whitespace at EOL
Python - relative paths from within modules
TV Aspect Ratios
Git - Which commits are in your branch only?
Subversion setup cheat sheet
Force detach a screen session
Modify sudo's use of environment variables
Install all Perl modules
Mutt - delete old messages
OpenVZ VPS and swap space
fail2ban on NetBSD for ssh
NetBSD - Using sup
Python - testing for a sys.exit
Python Best Practice Link Dump
Python script names
Perl - Using an expensive module
Speed of git clone
Perl Modules with Custom Prefix
Perl: tr vs. s
Brilliant sysadmin Reference
Why is GRUB better than LILO?
Why is swap space important?
Perldoc Output
Git's Index
Jira Project Keys
Git GUI