473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Funny Python error messages


Add your funny or surprising Python error messages to this
thread. A requirement is that you should also show
(minimal) code that produces the message. Put the code
below, so people can think about how to generate the message
first, a little puzzle if you like.

Perhaps this will even be a useful thread, to brighten the
life of the brave people doing the hard work of providing us
with error messages.

My first one (i'm learning, i'm learning) is

TypeError: 'callable-iterator' object is not callable

#
#
#
#
# >>> it = iter(lambda:0, 0)
# >>> it()
# TypeError: 'callable-iterator' object is not callable

Jul 18 '05 #1
4 5016
Will Stuyvesant wrote:
Perhaps this will even be a useful thread, to brighten the
life of the brave people doing the hard work of providing us
with error messages.

My first one (i'm learning, i'm learning) is

TypeError: 'callable-iterator' object is not callable

# >>> it = iter(lambda:0, 0)
# >>> it()
# TypeError: 'callable-iterator' object is not callable


Given that the supposed humour depends on the *name* of
the object, which is "callable-iterator", I'd say it's
probably not hard to come up with lots of "funny" error
messages this way.

For example:
def a(): .... print is_not
.... is_not = 0
.... a()

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 2, in a
UnboundLocalError: local variable 'is_not' referenced before assignment

My funny bone must be broken today, though, because I don't
see these as very funny...

(Did you understand *why* you got your error?
You don't call iterators, you call .next() on them...)

-Peter
Jul 18 '05 #2
Peter Hansen wrote:
My first one (i'm learning, i'm learning) is

TypeError: 'callable-iterator' object is not callable

# >>> it = iter(lambda:0, 0)
# >>> it()
# TypeError: 'callable-iterator' object is not callable


Given that the supposed humour depends on the *name* of
the object, which is "callable-iterator", I'd say it's
probably not hard to come up with lots of "funny" error
messages this way.


note that will didn't name the type himself. someone callously thought it would
be a cool idea to have a non-callable type called callable in python, rather than,
say, call it "iterator-that-dances-with-callables".

</F>

Jul 18 '05 #3

Peter Hansen wrote:
Will Stuyvesant wrote:
Perhaps this will even be a useful thread, to brighten the
life of the brave people doing the hard work of providing us
with error messages.

My first one (i'm learning, i'm learning) is

TypeError: 'callable-iterator' object is not callable

# >>> it = iter(lambda:0, 0)
# >>> it()
# TypeError: 'callable-iterator' object is not callable


Given that the supposed humour depends on the *name* of
the object, which is "callable-iterator", I'd say it's
probably not hard to come up with lots of "funny" error
messages this way.


The mildly amusing nature of this error message is due to Will's
finding a name, "callable-iterator" (where callable is a name, not a
description), appearing in a different context from where it was coined
that causes us to parse it differently (where callable is a
description, not a name), and accidentally stating an absurdity.
I'd say it's actually a nice bit of subtlety.

--
CARL BANKS

Jul 18 '05 #4
Will Stuyvesant wrote:
Add your funny or surprising Python error messages to this
thread. A requirement is that you should also show
(minimal) code that produces the message. Put the code
below, so people can think about how to generate the message
first, a little puzzle if you like.

Perhaps this will even be a useful thread, to brighten the
life of the brave people doing the hard work of providing us
with error messages.


I always liked:

ValueError: insecure string pickle

This error message is not strange if you think of "insecure", "string"
and "pickle" as programming terms, but it's hugely mystifying to someone
who isn't a programmer, since all of these words have different meanings
in real life.

Some code to produce it:
import cPickle
x = cPickle.dumps([1,2,3,"ratsj"])
y = x[:18] + "?" + x[18:]
cPickle.loads(y)

Traceback (most recent call last):
File "<input>", line 1, in ?
ValueError: insecure string pickle

--
Hans Nowak
http://zephyrfalcon.org/

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kenneth McDonald | last post by:
I'm setting myself up to use Python with jEdit (after trying jed, VIM, others...urggh.) One small problem I'm having is that while jEdit has a nice plugin called Console which can be set up to run...
0
by: Helmut Zeisel | last post by:
I want to build a static extension of Python using SWIG and VC++ 6.0 as described in http://www.swig.org/Doc1.3/Python.html#n8 for gcc. My file is testerl.i: ========================= %module...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 378 open ( +3) / 3298 closed (+34) / 3676 total (+37) Bugs : 886 open (-24) / 5926 closed (+75) / 6812 total (+51) RFE : 224 open...
18
by: Joel Hedlund | last post by:
Hi! The question of type checking/enforcing has bothered me for a while, and since this newsgroup has a wealth of competence subscribed to it, I figured this would be a great way of learning...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
3
by: koutoo | last post by:
Is it possible to display messages in the python shell? I want to display error messages based on parameters in my scripts to the users. Is there another way to display messages other than log...
8
by: karthikbalaguru | last post by:
Hi, One of my python program needs tkinter to be installed to run successfully. I am using Redhat 9.0 and hence tried installing by copying the tkinter-2.2.2-36.i386.rpm alone from the CD 3 to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.