Search Options
close
Search the following clips:
All Clips
Everyone's Clips
My Guides
Sign Up
Install
Learn More
Login
Ten quirky things about Python
ylodi
follow
0
1-16-2008 7:44 AM
98 views
tags:
python
Add a Comment
Login
to Comment. Not a member yet?
Sign up
Related Clips
Aging Monty Python's Eric Idle & Prince Ch...
Dead parrot's ancestors
Mythology Guide
Programming Cheat Sheet Round-up.
The Monty Python YouTube Channel!
Cleese on Hannity
Palin in Monty Python Audition
More clips from
ylodi
Disturbing new trend, bloatware on phones
4 Languages you should learn in 2009
European Commission publishes guidelines o...
Today's Top Clips
What Happy People Don't Do
Forgotten But Not Gone: How The Brain Re-learns
THE IMPRINTED BRAIN THEORY
The Boy With The Incredible Brain
This Dog is Awesome!
Physicists Find Dark Matter, or Something Even More Strange
Marijuana improves memory
Most Beautiful Homeless Hostel in the World
Less-Invasive Brain Interfaces
Time For Him To Go
visit the
Top Clips page
View the Top Clips from
January 16, 2008
Embed This Clip In Your Site...
<div style="margin: 12px 0px; font-family: arial; color: #333333; background: #ffffff; border: solid 4px #e5e5e5; width: 100%; clear: left;"><div class="CM_CTB_Content_Wrap" style="margin: 0px; padding: 0px;background-color: #ffffff;"><div style="border-bottom: solid 1px #dcdcdc; white-space: nowrap; margin-bottom: 8px; background-color: #eeeeee ;background-image: url(http://clipmarks.com/images/source-bg.gif); background-repeat: repeat-x; height: 24px; line-height: 24px; vertical-align: middle; padding-bottom: 4px; color: #666666; font-size: 10px;" ><a href="http://clipmarks.com/clip-to-blog/" title="see clips that are hot right now"><img src="http://content.clipmarks.com/blog_embed/0beebf84-11c0-40b8-b78d-6d57ddd2f170/35B98608-1EF0-477E-AB53-D0F1310731AA/" alt="" width="19" height="19" border="0" style="vertical-align: middle; margin: 0px 4px; display: inline; border: none; float:none;" /></a>clipped from <a title="http://blog.micropledge.com/2008/01/ten-python-quirkies/" href="http://blog.micropledge.com/2008/01/ten-python-quirkies/" style="font-size: 11px;">blog.micropledge.com</a></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://blog.micropledge.com/2008/01/ten-python-quirkies/"><H2><A title="Permanent link to this post" href="http://blog.micropledge.com/2008/01/ten-python-quirkies/">Ten quirky things about Python</A></H2></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://blog.micropledge.com/2008/01/ten-python-quirkies/"><P>Just thought I’d share a bunch of neat (and weird) things I’ve noticed about the <A href="http://python.org/">Python programming language</A>:</P></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://blog.micropledge.com/2008/01/ten-python-quirkies/"><li style="margin-left:16px;padding-left: 0px;">You can <A href="http://docs.python.org/ref/comparisons.html">chain comparisons</A> as in <CODE>assert 3.14 < pi < 3.15</CODE>. It’s a neat equivalent of <CODE>assert pi > 3.14 and pi < 3.15</CODE> that you can’t do in most other languages.</LI></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://blog.micropledge.com/2008/01/ten-python-quirkies/"><P>Ints don’t overflow at 31 (or 32) bits, they just get promoted to longs automatically. And long in Python doesn’t mean 64 bits, it means arbitrarily long (albeit somewhat slower). In fact, it looks like in Python 3000 <A href="http://www.python.org/dev/peps/pep-0237/">there won’t even be the int/long distinction</A>.</P></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://blog.micropledge.com/2008/01/ten-python-quirkies/"><P>When concatenating strings, <CODE>''.join(list)</CODE> is <A href="http://www.skymind.com/~ocrow/python_string/">much faster</A> than <CODE>for x in list: s += x</CODE>. In fact, the <CODE>join</CODE> is O(N) whereas the <CODE>+=</CODE> is O(N²). There’s been a <A href="http://mail.python.org/pipermail/python-dev/2004-August/046686.html">lot of debate</A> about making this faster, and it looks like it <A href="http://svn.python.org/view/python/trunk/Python/ceval.c?rev=36830&view=diff&r1=36830&r2=36829&p1=python/trunk/Python/ceval.c&p2=/python/trunk/Python/ceval.c">should be faster in Python 2.5</A>, but <A href="http://blogstatic.micropledge.com/2008/01/strcat.py.txt">my tests</A> show otherwise. Any ideas why?</P></blockquote></div><div style="margin: 0px 6px 6px 4px;"><table style="font-size: 11px;border-spacing: 0px;padding: 0px;" cellpadding="0" cellspacing="0" width="100%"><tr><td style="background:transparent;border-width:0px;padding:0px;"> </td><td align="right" style="background:transparent;border-width:0px;padding:0px;width:107px" width="107"><a href="http://clipmarks.com/share/35B98608-1EF0-477E-AB53-D0F1310731AA/blog/" title="blog or email this clip"><img src="http://content6.clipmarks.com/images/c2b-foot.png" border="0" alt="blog it" width="107" height="17" style="border-width:0px;padding:0px;margin:0px;" /></a></td></tr></table></div></div>
Clipmarks
Home
New Clips
Top Clips
Dashboard
Popular Topics
News
Life
Science
Technology
Entertainment
Get Started
Sign Up
Install Clipping Tool
How Clipping Works
Clip-to-Blog™
ClipSearch
Tools and Resources
FAQ
ClipWeek
Top Clippers
Top Tags
Site Map
About Clipmarks
About Us
Contact
Blog
Copyright
Privacy
EULA
OK