[IPython-user] [IPython-dev] IPython tab-completion behaviour in Linux

Kenneth Arnold kenneth.arnold@gmail....
Sun Aug 2 13:30:14 CDT 2009


list.`sort` modifies the list in-place, so it returns None (so you
don't think you still have the unsorted copy somewhere).

Try  `sorted([1,2,3])`.

-Ken



On Sun, Aug 2, 2009 at 10:46 AM, Gökhan Sever<gokhansever@gmail.com> wrote:
> The following seems like another bug, that matters only for bare list
> instantiation "[]". String "" and dict {} objects seemingly works as
> expected.
>
> RC1 also has the same issue.
>
> Could you confirm?
>
>
> Python 2.6 (r26:66714, Jun  8 2009, 16:07:26)
> IPython 0.10.bzr.r1174 -- An enhanced Interactive Python.
>
> In [1]: a = [3, 1, 6, -2]
>
> In [2]: a.sort()
>
> In [3]: a
> Out[3]: [-2, 1, 3, 6]
>
> In [4]: b = [3, 1, 6, -2].sort()
>
> In [5]: b
>
> In [6]: whos
> Variable   Type        Data/Info
> --------------------------------
> a          list        [-2, 1, 3, 6]
> b          NoneType    None
>
>
> Thanks.
>
> On Mon, Jul 27, 2009 at 12:05 PM, Brian Granger <ellisonbg.net@gmail.com>
> wrote:
>>
>> Thanks for posted this bug report.
>>
>> Brian
>>
>> On Mon, Jun 29, 2009 at 9:25 AM, Gökhan SEVER <gokhansever@gmail.com>
>> wrote:
>>>
>>> On Mon, Jun 29, 2009 at 9:04 AM, Jeff Kaufman<jeff@alum.swarthmore.edu>
>>> wrote:
>>> > G??khan SEVER wrote:
>>> >>
>>> >> See the examples below:
>>> >>
>>> >> [gsever@ccn ~]$ ipython
>>> >>  Logging to /home/gsever/.ipython/2009-06-29.py
>>> >>
>>> >> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
>>> >> Type "copyright", "credits" or "license" for more information.
>>> >>
>>> >> IPython 0.10.bzr.r1174 -- An enhanced Interactive Python.
>>> >> ...
>>> >>
>>> >> In [1]: "".
>>> >> Display all 104 possibilities? (y or n)
>>> >>
>>> >> In [1]: "".s
>>> >> .sage             .serverauth.5593  .subversion
>>> >> .scribus          .ssh
>>> >>
>>> >> In [1]: [].
>>> >> Display all 104 possibilities? (y or n)
>>> >>
>>> >> In [1]: [].sort()
>>> >>
>>> >> In [2]: [].sort?
>>> >> Type:         list
>>> >> Base Class:   <type 'list'>
>>> >> String Form:  []
>>> >> Namespace:    Interactive
>>> >> Length:               0
>>> >> Docstring:
>>> >>     list() -> new list
>>> >>     list(sequence) -> new list initialized from sequence's items
>>> >>
>>> >
>>> > Note that some of this does work for strings:
>>> >
>>> >  In [1]: ''.join?
>>> > Type:           str
>>> > Base Class:     <type 'str'>
>>> > String Form:
>>> > Namespace:      Interactive
>>> > Length:         0
>>> > Docstring:
>>> >    str(object) -> string
>>> >
>>> >    Return a nice string representation of the object.
>>> >    If the argument is a string, the return value is the same object.
>>> >
>>> >  In [2]: "".join?
>>> > Type:           str
>>> > Base Class:     <type 'str'>
>>> > String Form:
>>> > Namespace:      Interactive
>>> > Length:         0
>>> > Docstring:
>>> >    str(object) -> string
>>> >
>>> >    Return a nice string representation of the object.
>>> >    If the argument is a string, the return value is the same object.
>>> >
>>> > And the issues are not limited to empty strings:
>>> >
>>> >  In [3]: "test".<tab>
>>> > .svn/entries    .svn/prop-base  .svn/text-base
>>> > .svn/format     .svn/props      .svn/tmp
>>> >
>>> >  In [3]: "test".svn/
>>> >
>>> > (In this case, .svn is the only dotfile in the curdir)
>>> >
>>> > Spaces change the matter:
>>> >
>>> >  In [4]: "this is a test".<tab>
>>> >
>>> > Does nothing.
>>> >
>>> > The problem has something to do with the interaction of tab completion
>>> > and quote marks, and the current behavior doesn't make much sense.
>>> >
>>> > Jeff
>>> >
>>>
>>> I am pinging the devel list, just in case someone might say something
>>> about this issue. If not, I will post a bug at
>>> https://bugs.launchpad.net/ipython/
>>>
>>> >From my IPy shell, as also Jeff noted, empty or non-empty objects
>>> cannot list their associated methods and attributes without assigning
>>> them to names.
>>>
>>> Some additional information, I use:
>>>
>>> Linux ccn 2.6.27.19-170.2.35.fc10.i686.PAE (Fedora 10)
>>> Python 2.5.2
>>> IPython 0.10.bzr.r1174
>>> GNU bash, version 3.2.39
>>>
>>> In [1]: [1,2,3].
>>> Display all 104 possibilities? (y or n)
>>>
>>> In [1]: {1:'a', 2:'b'}.
>>> Display all 104 possibilities? (y or n)
>>>
>>> In [2]: a = {1:'a', 2:'b'}
>>>
>>> In [3]: a.
>>> a.__class__         a.__le__            a.get
>>> a.__cmp__           a.__len__           a.has_key
>>> a.__contains__      a.__lt__            a.items
>>> a.__delattr__       a.__ne__            a.iteritems
>>> a.__delitem__       a.__new__           a.iterkeys
>>> a.__doc__           a.__reduce__        a.itervalues
>>> a.__eq__            a.__reduce_ex__     a.keys
>>> a.__ge__            a.__repr__          a.pop
>>> a.__getattribute__  a.__setattr__       a.popitem
>>> a.__getitem__       a.__setitem__       a.setdefault
>>> a.__gt__            a.__str__           a.update
>>> a.__hash__          a.clear             a.values
>>> a.__init__          a.copy
>>> a.__iter__          a.fromkeys
>>> _______________________________________________
>>> IPython-dev mailing list
>>> IPython-dev@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>
>
>
> --
> Gökhan
>
> _______________________________________________
> IPython-user mailing list
> IPython-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>


More information about the IPython-user mailing list