[PyQt] PyQt4.Qtcore defines 'hex'
Chris Withers
chris at simplistix.co.uk
Wed Jan 7 09:26:40 GMT 2009
Phil Thompson wrote:
> On Tue, 06 Jan 2009 14:19:50 -0500, Neal Becker <ndbecker2 at gmail.com>
> wrote:
>> A bit nasty, since I see (and follow) lots of examples that say:
>> from PyQt4.QtCore import *
>>
>> This redefines the builtin hex.
>
> Check the Roadmap.
Appending a _ just to make an unpleasant style of programming work seems
like a pretty silly idea.
I, along with everyone else who's tryng to learn a new python package,
absolutely *hate* "from x import *" as it makes it much more difficult
figure out where something is coming from.
I did raise this with David when this very issue tripped me and a number
of other people up at the PyConUK tutorial last year.
If this were done sanely, you'd likely have:
from PyQt4.QtCore import hex
...somewhere, which, if it's causing problems, can easilly be changed to:
from PyQt4.QtCore import hex as qt_hex
Or, if you don't want do have a load of import statements, you can use
the style that xlrd seems to prefer:
from PyQt4 import QtCore
...
QtCore.hex(...)
Either way, you end up knowing where stuff if coming from...
cheers,
Chris (who's still putting off using PyQt as he's dreading fighting his
way through a load of *'s)
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the PyQt
mailing list