Tags
- android
- art
- beauty
- bible
- blogging
- brisbane
- christianity
- community
- dancing
- design
- development
- framework
- free
- God
- ideas
- javascript
- laptop
- life
- mercurial
- music
- musings
- people
- physics
- politics
- programming
- programming languages
- public transport
- pyconau
- pygame
- python
- refactoring
- scripting
- software
- story
- testing
- tips
- tools
- trosnoth
- troubleshooting
- twisted
- ubuntu
- web
- window manager
- wireless
Links
Archives
- July 2023
- March 2022
- April 2020
- April 2019
- March 2019
- January 2019
- November 2018
- October 2018
- September 2018
- April 2016
- September 2015
- August 2014
- April 2014
- February 2014
- January 2014
- August 2013
- July 2013
- June 2013
- May 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- September 2012
- August 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- November 2011
- October 2011
- April 2011
- March 2011
- February 2011
- January 2011
- November 2010
- October 2010
- July 2010
- June 2010
- May 2010
- April 2010
Category Archives: short
Something Fishy with Python ASTs
1 2 3 4 5 6 7 8 9 10 |
$ python Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import ast >>> m = ast.parse('from __future__ import division') >>> m <_ast.Module object at 0xb764418c> >>> compile(m, '<string>', 'exec') at 0xb7636e78, file "<string>", line 1> |
Ok, so far so good. Now comes the interesting bit.
1 2 3 4 5 6 7 8 9 |
>>> import pickle >>> m2 = pickle.loads(pickle.dumps(m)) >>> m2 <_ast.Module object at 0xb7651c0c> >>> compile(m2, '<string>', 'exec') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 1 SyntaxError: from __future__ imports must occur at the beginning of the file |
When you parse an AST with a __future__ import, it looks as if it stores some hidden flags that suppress this error. These flags, if they exist, are … Continue reading
Again: Broadcom Wireless BCM43224, Ubuntu
Update 2013-02-27: This solution on Ask Ubuntu is much better, because it includes properly packaged things that should update when you upgrade Ubuntu. Update 2012-10-24: The patch is no longer available on Broadcom’s website, but it can be found here. … Continue reading
Social Debate
I posted the same thing on Google Buzz and on Facebook with rather different results.
Posted in short
Tagged buzz, debate, facebook, google, social media, social networking
Comments Off on Social Debate
Import Graphs for Python
I was doing some Trosnoth refactoring recently, and I wanted a tool that would draw import graphs of the Trosnoth subpackages. After a quick search of the Internet didn’t give me what I wanted, I set about to write my … Continue reading
Posted in short
Tagged graphs, imports, programming, python, refactoring, tools, trosnoth
Comments Off on Import Graphs for Python
Welcome to the New-Look Sqizit
Today I’ve moved Sqizit to a new host, updated the theme, and fixed the formatting of old articles. For those interested, a brief history of Sqizit: In the distant past I tried starting blogs a few times (mostly on blogger.com), … Continue reading