473,383 Members | 1,863 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,383 software developers and data experts.

pydev code completion problem

Hi, I need help with pydev code completion...

Let's assume that we have something like this:

class One:
def fun(self):
return 1

class Two:
li = []
li.append(One())

one = li[0]
print one.fun()

one2 = li.pop()
print one2.fun()

one3 = One()
print one3.fun()

Only for 'one3' variable code completion is working fine (as expected it
show fun()).
For 'one' code completion shows something (but not fun()).
For 'one2' code completion shows nothing :-(

I use Eclipse 3.3.1 with PyDev 1.3.9 on Ubuntu 7.04.

Can anyone confirm or deny this behavior of PyDev?
Oct 14 '07 #1
9 2317
On Sun, 14 Oct 2007 19:45:07 +0000, Lukasz Mierzejewski wrote:
Let's assume that we have something like this:

class One:
def fun(self):
return 1

class Two:
li = []
li.append(One())

one = li[0]
print one.fun()

one2 = li.pop()
print one2.fun()

one3 = One()
print one3.fun()
Indention is messed up here. At least the ``return`` in `One.fun()`. And
what is class `Two` meant to do?
Only for 'one3' variable code completion is working fine (as expected it
show fun()).
For 'one' code completion shows something (but not fun()).
For 'one2' code completion shows nothing :-(

I use Eclipse 3.3.1 with PyDev 1.3.9 on Ubuntu 7.04.

Can anyone confirm or deny this behavior of PyDev?
I can confirm and it's something I would expect. It is obvious to *you*
that there is a `One` object in that list, but it would get very quickly
very complicated for an IDE to keep track of objects if not even
impossible.

Ciao,
Marc 'BlackJack' Rintsch
Oct 14 '07 #2
Confirmed (with exactly the same software).

Please discuss this issue at the PyDev discussion forum:
http://sourceforge.net/forum/forum.php?forum_id=293649

2B

Oct 14 '07 #3
I can confirm and it's something I would expect. It is obvious to *you*
that there is a `One` object in that list, but it would get very
Thank you for confirmation and your time!
quickly very complicated for an IDE to keep track of objects if not
even impossible.
I guess that you are right, but I wonder if there exists some
'tricks/magic' to overcome the fact that python is dynamically typed...

Tomorrow I will try Wing IDE...
But maybe someone use Komodo IDE or Wing IDE and can tell how they handle
situations like this? How works code completion in those IDE's?
Oct 14 '07 #4
On Sun, 14 Oct 2007 20:36:07 +0000, cyberco wrote:
Confirmed (with exactly the same software).

Please discuss this issue at the PyDev discussion forum:
http://sourceforge.net/forum/forum.php?forum_id=293649

Thank you for replay, but I'm still not sure what to think about it...
Marc 'BlackJack' Rintsch in his replay to my post says that it would be to
complicated for IDE to keep track of all objects... isn't he right?
Oct 14 '07 #5
Lukasz Mierzejewski schrieb:
On Sun, 14 Oct 2007 20:36:07 +0000, cyberco wrote:
>Confirmed (with exactly the same software).

Please discuss this issue at the PyDev discussion forum:
http://sourceforge.net/forum/forum.php?forum_id=293649


Thank you for replay, but I'm still not sure what to think about it...
Marc 'BlackJack' Rintsch in his replay to my post says that it would be to
complicated for IDE to keep track of all objects... isn't he right?
He is right. What would you expect from this piece of code:
foo = random.choose([A(), B(), C(), ..., Z()])

What PyDev does is to implement some heuristics that can guess easy
cases - as you saw for yourself. But there is a limit to what can be
done. Instead, it might even introduce errors.

Diez
Oct 14 '07 #6
On Sun, 14 Oct 2007 21:57:12 +0000, Lukasz Mierzejewski wrote:
On Sun, 14 Oct 2007 20:36:07 +0000, cyberco wrote:
>Confirmed (with exactly the same software).

Please discuss this issue at the PyDev discussion forum:
http://sourceforge.net/forum/forum.php?forum_id=293649


Thank you for replay, but I'm still not sure what to think about it...
Marc 'BlackJack' Rintsch in his replay to my post says that it would be
to complicated for IDE to keep track of all objects... isn't he right?

*shakes head sadly*

Young programmers today, with your IDEs and code completion and syntax
highlighting... when I was your age, we used "ed" and liked it!
http://www.gnu.org/fun/jokes/ed.msg.html

--
Steven
Oct 14 '07 #7
But maybe someone use Komodo IDE or Wing IDE and can tell how they handle
situations like this? How works code completion in those IDE's?
I've downloaded and checked both of them (both have Linux version which is
nice thing). Both did worse job with code completion then PyDev with my
simple example.

In my opinion PyDev code completion is really superior to Komodo's and
WingIDE's...
Oct 14 '07 #8
He is right. What would you expect from this piece of code:
>

foo = random.choose([A(), B(), C(), ..., Z()])
Thank you all for dispelling my stupid doubts!
What PyDev does is to implement some heuristics that can guess easy
cases - as you saw for yourself. But there is a limit to what can be
done. Instead, it might even introduce errors.
I have just checked WingIDE and Komodo IDE and those PyDev heuristics do
much better work then code completion solutions in WingIDE and Komodo...
Oct 14 '07 #9
On Oct 14, 9:45 pm, Lukasz Mierzejewski <lmier...@o2.plwrote:
Hi, I need help with pydev code completion...

Let's assume that we have something like this:

class One:
def fun(self):
return 1

class Two:
li = []
li.append(One())

one = li[0]
print one.fun()

one2 = li.pop()
print one2.fun()

one3 = One()
print one3.fun()

Only for 'one3' variable code completion is working fine (as expected it
show fun()).
For 'one' code completion shows something (but not fun()).
For 'one2' code completion shows nothing :-(

I use Eclipse 3.3.1 with PyDev 1.3.9 on Ubuntu 7.04.

Can anyone confirm or deny this behavior of PyDev?
It would be very great if a solution like this could exist, but it
can't at all, because python is very dynamic.
Not like in other languages like C, C++ or Java, in python if you use
a list, you do not have to declare what the list hold, it can contains
everything. Moreover, it can contains different sort of object that
may have nothing in common.

Has you have seen, this imply a "problem": python or an IDE can't
predict until runtime what it have to manipulate.

NOTA: this is true for everything in python, even for functions
You could easily do something like this:

class my_empty_object(object):
pass

# We create an empty object (without any method)
meo = my_empty_object()

# We create something like a method
def f(string):
print string

#We add it to the object
meo.func = f

#Now we call it
meo.func('it works!')
>>it works!
Oct 15 '07 #10

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

Similar topics

0
by: Fabio Zadrozny | last post by:
Hi All, PyDev - Python IDE (Python Development Enviroment for Eclipse) version 0.9.8.3 has been released. Check the homepage (http://pydev.sourceforge.net/) for more details. Details for...
0
by: Fabio Zadrozny | last post by:
Hi All, PyDev - Python IDE (Python Development Enviroment for Eclipse) version 0.9.8.6 has been released. Check the homepage (http://pydev.sourceforge.net/) for more details. Details for...
5
by: John Henry | last post by:
I am back against the wall trying to migrate my multithreaded application from Python 2.3 to 2.5. The part of the code that's failing has to do with queues (2.3 queues and 2.5 queues are not the...
0
by: Fabio Zadrozny | last post by:
Hi All, Pydev and Pydev Extensions 1.3.16 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development:...
0
by: Fabio Zadrozny | last post by:
Hi All, Pydev and Pydev Extensions 1.3.17 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development:...
0
by: Fabio Zadrozny | last post by:
Hi All, Pydev and Pydev Extensions 1.3.18 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development:...
0
by: Fabio Zadrozny | last post by:
Hi All, Pydev and Pydev Extensions 1.3.22 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development:...
0
by: Fabio Zadrozny | last post by:
Hi All, Pydev and Pydev Extensions 1.3.23 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development:...
0
by: Fabio Zadrozny | last post by:
Hi All, Pydev and Pydev Extensions 1.3.24 have been released This is a high-priority release to fix some blocker bugs (that's why it was released in such a short time from the last release) ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.