[issue6829] Frendly error message when inheriting from function

2012-10-31 Thread Yongzhi Pan

Changes by Yongzhi Pan :


--
nosy: +fossilet

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2010-07-31 Thread Georg Brandl

Georg Brandl  added the comment:

In Python 3, due to the new class creation the somewhat confusing message 
augmentation has been removed altogether, and for me there seems to be no way 
to add a better message about base class types somewhere without making too 
many assumptions.

--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2009-09-16 Thread Gabriel Genellina

Changes by Gabriel Genellina :


--
nosy: +gagenellina

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2009-09-07 Thread R. David Murray

R. David Murray  added the comment:

It is possible that a TypeError could arise during the execution of the
metaclass bases that is not the result of inheriting from something
other than a class/type.  It might, however, be possible to enhnace the
message with the name of the metaclass or first base class...but someone
who knows more about the interpreter internals than I do would have to
be willing to take that on, as it isn't clear to me from reading the
code what the right thing would be to put in the message.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2009-09-07 Thread anatoly techtonik

anatoly techtonik  added the comment:

Or with more info if possible:

Error when inheriting class "%s" - parent is not a class.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2009-09-07 Thread anatoly techtonik

anatoly techtonik  added the comment:

Or just:

Error inheriting from object that is not a class

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2009-09-07 Thread anatoly techtonik

anatoly techtonik  added the comment:

How about:

Error running metaclass bases
(attempt to inherit from object that is not a class)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2009-09-04 Thread R. David Murray

R. David Murray  added the comment:

That would still be special-casing, you'd just be special casing three
things instead of one, nor does that exhaust the list of things for
which you might get this kind of error.

However, the code that generates the error message contains the
following comment:

/* A type error here likely means that the user passed
   in a base that was not a class (such the random module
   instead of the random.random type).  Help them out with
   by augmenting the error message with more information.*/

So, it seems to me that the author (I think it was Raymond, so I'm
setting him nosy) was trying to give the requested clue, but it sounds
like the error message isn't quite achieving that goal.

I've tried several rephrasings, but I haven't come up with one I'm
completely happy with.  It seems that the most common problem is trying
to use an instance as a base, and if that is correct the best I've come
up with so far is:

"Error when calling the metaclass bases (specified base may be an
instance instead of a class)"

--
keywords: +easy
nosy: +r.david.murray, rhettinger
priority:  -> low
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2009-09-04 Thread anatoly techtonik

Changes by anatoly techtonik :


--
status: closed -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2009-09-04 Thread anatoly techtonik

anatoly techtonik  added the comment:

Ok, but why not to change the message to less cryptic 
"Impossible to inherit class from function(), string or int"?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2009-09-04 Thread Georg Brandl

Georg Brandl  added the comment:

You'll get a similar message when trying to inherit from e.g. a string
or an int.  I see no compelling reason to special-case functions here.

--
nosy: +georg.brandl
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6829] Frendly error message when inheriting from function

2009-09-03 Thread anatoly techtonik

New submission from anatoly techtonik :

It is an error to try to inherit from function and the error message in 
this case is:
{{{
Traceback (most recent call last):
  File "", line 1, in 
  File "m:\p\pb.py", line 4, in 
class PostgreSQLConnection(DatabaseConnection):
TypeError: Error when calling the metaclass bases
function() argument 1 must be code, not str
}}}

Something like 'Impossible to inherit from function' will clear 
confusion state from users unfamiliar with metaclasses.
{{{
def DatabaseConnection(object):
pass

class PostgreSQLConnection(DatabaseConnection):
pass
}}}

--
components: Interpreter Core
messages: 92191
nosy: techtonik
severity: normal
status: open
title: Frendly error message when inheriting from function
type: behavior
versions: Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com