Nicolas Girard | 1 Jun 13:33 2005
Picon

Re: [Eric] How to use ipython ?

On Tuesday 31 May 2005 18:59, Detlev Offenbach wrote:
> Hi,
>
> I haven't tried this and actually I don't see the need for it. 

Actually the IPython feature I'm the most missing, if not the only one, is 
completion. This is a valuable improvement over the standard python 
interpreter, when in the implementation/testing phase ; that's why it made 
sense to me to have IPython run "inside" a python IDE...

> IPython's 
> features will most probably not show up in the Python shell of the IDE. The
> "Custom python interpreter" is meant to name a python interpreter to run
> the debugger client side.

I'm not sure I understood correctly : is the interpreter appearing at the 
bottom of Eric the one that runs the debugger client side ?

Cheers,
Nicolas

Diez B. Roggisch | 1 Jun 14:20 2005
Picon

Re: Re: [Eric] How to use ipython ?


> Actually the IPython feature I'm the most missing, if not the only one, is
> completion. This is a valuable improvement over the standard python
> interpreter, when in the implementation/testing phase ; that's why it made
> sense to me to have IPython run "inside" a python IDE...

My eric has tab-completion working in it's interpreter already - in form of a 
window popping up giving me the possible choices. Which is nice, but could 
IMHO enhanced a great deal by implementing in incrementally, like the 
autocompletion in scintill. Any chances we see that coming, Detlev?

Regards,

Diez

Detlev Offenbach | 1 Jun 18:34 2005
Picon

Re: Re: [Eric] How to use ipython ?

Am Mittwoch, 1. Juni 2005 14:20 schrieb Diez B. Roggisch:
> > Actually the IPython feature I'm the most missing, if not the only one,
> > is completion. This is a valuable improvement over the standard python
> > interpreter, when in the implementation/testing phase ; that's why it
> > made sense to me to have IPython run "inside" a python IDE...
>
> My eric has tab-completion working in it's interpreter already - in form of
> a window popping up giving me the possible choices. Which is nice, but
> could IMHO enhanced a great deal by implementing in incrementally, like the
> autocompletion in scintill. 

It has the scintilla autocompletion as well

> Any chances we see that coming, Detlev? 

I'll look into this for the 3.8 development, but won't promise anything.

>
> Regards,
>
> Diez
>
> _______________________________________________
> PyKDE mailing list    PyKDE <at> mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Detlev
--

-- 
Detlev Offenbach
detlev <at> die-offenbachs.de
(Continue reading)

Matej Cepl | 2 Jun 04:10 2005
Picon

Can I use QString as key in Python dictionary?

Hi,

I have this simple dialog in PyQt, but whenever I press any item in the list
(or click OK), I get this error:

        chelcicky:pycatsel$ ./pycatsel
        Traceback (most recent call last):
          File "/home/matej/archiv/programky/vim-qadas/pycatsel/selectCode.py",\
        line 148, in Quit
            note = unicode(self.dictCategories[key])
        KeyError: <__main__.qt.QString object at 0xb7e12c5c>
        chelcicky:pycatsel$

Does anybody have any idea, what's wrong? Can I use QString as a key in
Python dictionary (both key and dict's values are QStrings)?

Thanks a lot,

        Matej

--

-- 
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488

I am a Roman Catholic, so that I do not expect `history' to be
anything but a `long defeat' -- though it contains (and in
a legend may contain more clearly and movingly) some samples or
glimpses of final victory.
      -- J.R.R. Tolkien
(Continue reading)

Sebastian Kügler | 2 Jun 04:35 2005
Picon

Re: Can I use QString as key in Python dictionary?

On Thursday 02 June 2005 04:10, Matej Cepl wrote:
> I have this simple dialog in PyQt, but whenever I press any item in
> the list (or click OK), I get this error:
>
>         chelcicky:pycatsel$ ./pycatsel
>         Traceback (most recent call last):
>           File
> "/home/matej/archiv/programky/vim-qadas/pycatsel/selectCode.py",\
> line 148, in Quit
>             note = unicode(self.dictCategories[key])
>         KeyError: <__main__.qt.QString object at 0xb7e12c5c>
>         chelcicky:pycatsel$
>
> Does anybody have any idea, what's wrong? Can I use QString as a key
> in Python dictionary (both key and dict's values are QStrings)?

>>> from qt import *
>>> QString("foo") is QString("foo")
False

As you can see these two QString are different objects, so there's 
actually no such key.

>>> k = QString("bla")
>>> mydict = {QString("bla"):"foobar"}
>>> mydict[k]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
KeyError: <qt.QString object at 0xb7df350c>

(Continue reading)

Torsten Marek | 2 Jun 08:08 2005
Picon
Picon

Re: Can I use QString as key in Python dictionary?


Sebastian Kügler schrieb:
> On Thursday 02 June 2005 04:10, Matej Cepl wrote:
> 
>>I have this simple dialog in PyQt, but whenever I press any item in
>>the list (or click OK), I get this error:
>>
>>        chelcicky:pycatsel$ ./pycatsel
>>        Traceback (most recent call last):
>>          File
>>"/home/matej/archiv/programky/vim-qadas/pycatsel/selectCode.py",\
>>line 148, in Quit
>>            note = unicode(self.dictCategories[key])
>>        KeyError: <__main__.qt.QString object at 0xb7e12c5c>
>>        chelcicky:pycatsel$
>>
>>Does anybody have any idea, what's wrong? Can I use QString as a key
>>in Python dictionary (both key and dict's values are QStrings)?
> 
> 
>>>>from qt import *
>>>>QString("foo") is QString("foo")
> 
> False
> 
> As you can see these two QString are different objects, so there's 
> actually no such key.
> 
> 
>>>>k = QString("bla")
(Continue reading)

Gerard Vermeulen | 2 Jun 09:54 2005
Picon

Re: Can I use QString as key in Python dictionary?

On Thu, 02 Jun 2005 08:08:34 +0200
Torsten Marek <shlomme <at> gmx.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Sebastian Kügler schrieb:
> > On Thursday 02 June 2005 04:10, Matej Cepl wrote:
> > 
> >>I have this simple dialog in PyQt, but whenever I press any item in
> >>the list (or click OK), I get this error:
> >>
> >>        chelcicky:pycatsel$ ./pycatsel
> >>        Traceback (most recent call last):
> >>          File
> >>"/home/matej/archiv/programky/vim-qadas/pycatsel/selectCode.py",\
> >>line 148, in Quit
> >>            note = unicode(self.dictCategories[key])
> >>        KeyError: <__main__.qt.QString object at 0xb7e12c5c>
> >>        chelcicky:pycatsel$
> >>
> >>Does anybody have any idea, what's wrong? Can I use QString as a key
> >>in Python dictionary (both key and dict's values are QStrings)?
> > 
> > 
> >>>>from qt import *
> >>>>QString("foo") is QString("foo")
> > 
> > False
> > 
(Continue reading)

Matej Cepl | 2 Jun 15:47 2005
Picon

Re: Can I use QString as key in Python dictionary?

Gerard Vermeulen wrote:
> A Python string is immutable and a QString is mutable.
> 
> You'll may get undefined behaviour if you change a QString key while
> manipulating a dictionary containing that QString key.

Thanks a lot, the end of mystery. So I will probably stay with my
subclassing dict:

class NoteDict(dict):
    def __init__(self):
        pass

    def __getitem__(self,y):
        key = unicode(y)
        return dict.__getitem__(self,key)

    def __setitem__(self,i,y):
        key = unicode(i)
        dict.__setitem__(self,key,y)

    def __delitem__(self,y):
        key = unicode(y)
        dict.__delitem__(self,key)

Is there any better way how to do it?

        Matej

--

-- 
(Continue reading)

James Emerton | 3 Jun 20:13 2005
Picon

QString vs PyString

I am using PyQt as a way to provide UI to scriptable plugins for a
C++/Qt application.  The business end of this app is written in
standard C++ with some usage of boost libraries.  Qt is used
_strictly_ for the UI.  This means that strings in the business logic
are std::string objects (Unicode is not used.)

When using Qt from C++, the QString<->std::string conversion is
automatic.  I don't have to worry about what kind of string I'm using.
 (Apart from minimizing excessive conversions that would lead to a
loss of performance.)

>From within Python, this is not so clean and elegant.  The business
API does not understand what a QString is, and complains of invalid
argument types if I forget to convert the string with str().

So I have two thoughts...

I can alter the std::string MappedType definition to understand
QStrings.  This seems a bit of a hack to me.  The std::string
definition belongs to a module that isn't supposed to know anything
about Qt.  I may need to link the Qt library to this module as well,
which is not desirable.

The other alternative, which I have not had the chance to experiment
with yet, is to use a Feature directive to change the wrapping of
QString to a mapped type.  I'd probably create two versions; one for
unicode.  This seems like the more pythonic way of doing things, but
I'm wondering if I'll run into a lot of issues.

This all leads me to thinking about the strategies used whenan API
(Continue reading)

Matej Cepl | 3 Jun 20:40 2005
Picon

Re: QString vs PyString

James Emerton wrote:
> This all leads me to thinking about the strategies used whenan API
> targeting one language is wrapped for some other language with
> different idioms and culture.  In many cases, utility types (such as
> QString, QDate[Time]) have fully capable couterparts native to the
> environment in which the developer is using.  What is the advantage to
> wrapping these types, as opposed to mapping them to native types?

And why do you have to use QString at all? Cannot you just use Python's
native strings/unicode strings? Read more about the relationship between
Python's and Qt-string machinery read
        http://www.opendocs.org/pyqt/index.lxp?lxpwrap=c2029%2ehtm

Best,

        Matej

--

-- 
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488

It would be very good idea.
   -- Gandhi, when asked what he thinks about Western
      civilization?


Gmane