FAQ
Hello, I am using eclips for python and i am facing a problem. I have
many classes with many properties and want a list of objects from one
of my declared classes. The problem is:When i am accessing any item
from the list, the IDE does not know it's type because in python we do
not declare the variable with it's type, so there is no auto complete
and i have to go to the class to copy the attribute name. To make idea
more clear:

class AutomataBranch(object):
def __init__(selfparams):
self.Name="";
self.nodes=[];

class LanguageAutomata(object):
def __init__(selfparams):
self.cfgAutomata=[];#This has AutomaBranch Type
Now in any method in LanguageAutomata class if i wrote: cfgAutomata.
Then it wont give me the Name attribute Is there any solution for
that?
Perhaps of there is some thing like C# List<AutomataBranch>
cfgAutomata such that the list wont accept items unless they are
AutomataBranch will be good.

Search Discussions

  • Fabio Zadrozny at Aug 17, 2009 at 9:13 pm

    Hello, I am using eclips for python and i am facing a problem. I have
    many classes with many properties and want a list of objects from one
    of my declared classes. The problem is:When i am accessing any item
    from the list, the IDE does not know it's type because in python we do
    not declare the variable with it's type, so there is no auto complete
    and i have to go to the class to copy the attribute name. To make idea
    more clear:

    class AutomataBranch(object):
    ? ?def __init__(selfparams):
    ? ? ? ?self.Name="";
    ? ? ? ?self.nodes=[];

    class LanguageAutomata(object):
    ? ?def __init__(selfparams):
    ? ? ? ?self.cfgAutomata=[];#This has AutomaBranch Type
    Now in any method in LanguageAutomata class if i wrote: cfgAutomata.
    Then it wont give me the Name attribute Is there any solution for
    that?
    Perhaps of there is some thing like C# List<AutomataBranch>
    cfgAutomata such that the list wont accept items unless they are
    AutomataBranch will be good.

    Hello,

    Unfortunately, right now there is no way to gather that specific code
    completion in pydev -- because of the dynamic nature of python, that
    info is very hard to get.

    Best Regards,

    Fabio
  • هاني الموصلي at Aug 17, 2009 at 9:19 pm
    Please could you lead me to a way or a good IDE that makes developing
    huge projects in python more easier than what i found.Now i am using
    eclips. Actually it is very hard to remember all my classes methods
    and attributes or copy and paste them each time.
    Thanks very much for your interest
    Hani Almousli.....
  • Jonathan Gardner at Aug 18, 2009 at 12:14 am

    On Aug 17, 2:19?pm, ???? ??????? wrote:
    Please could you lead me to a way or a good IDE that makes developing
    huge projects in python more easier than what i found.Now i am using
    eclips. Actually it is very hard to remember all my classes methods
    and attributes or copy and paste them each time.
    Thanks very much for your interest
    Hani Almousli.....
    You're relying on your IDE too much. You should rely on the code and
    on your own notes. Your project should never get big because there is
    no reason to throw in a bunch of useless code.

    Think of the simplest way to get your job done. Then write that in
    pseudo-code. Finally, run it in Python to see if it actually works.
    You may be surprised with how far that will get you.

    If you are having problems remembering the attributes and methods of
    your instances, you are probably using too many attributes and
    methods, their names are too long, or you have too many arguments to
    each method. Keep the interfaces between parts as simple as possible.

    If you still have a big project, then break it up into several
    smaller, re-usable, and independent modules. Keep the interfaces as
    simple as possible, and never write code that does anything but Duck-
    Typing.
  • Diez B. Roggisch at Aug 18, 2009 at 6:46 am

    ???? ??????? schrieb:
    Please could you lead me to a way or a good IDE that makes developing
    huge projects in python more easier than what i found.Now i am using
    eclips. Actually it is very hard to remember all my classes methods
    and attributes or copy and paste them each time.
    Thanks very much for your interest
    Hani Almousli.....
    There are many really big projects written in Python - none of them with
    the aid of intelli-sense.

    What python lacks in that respect due to it's dynamic typing, it more
    than compensates by being faster to develop and having to write much
    less code.

    Diez
  • Albert Hopkins at Aug 18, 2009 at 10:26 am

    On Tue, 2009-08-18 at 08:46 +0200, Diez B. Roggisch wrote: <???? ??????? schrieb:
    Please could you lead me to a way or a good IDE that makes developing
    huge projects in python more easier than what i found.Now i am using
    eclips. Actually it is very hard to remember all my classes methods
    and attributes or copy and paste them each time.
    Thanks very much for your interest
    Hani Almousli.....
    There are many really big projects written in Python - none of them with
    the aid of intelli-sense.

    What python lacks in that respect due to it's dynamic typing, it more
    than compensates by being faster to develop and having to write much
    less code.
    But this class can do *anything*! It .slice()s.. It .dice()s...


    ... sorry, couldn't resist ;-)

    -a
  • هاني الموصلي at Aug 18, 2009 at 11:37 am
    I think i found a good managable solution. Actually it is trivial but
    may help (I used it now).
    When i wnat to access the list then i assign the object which i want
    to access to a variable ex:
    1)x=AutomataBranch()
    2)x=self.cfgAutomata[i]

    The first line is used only to make the IDE knows that x is from
    AutomatBranch type.After that when i press x. then all methods and
    properties are visualized.

    I think it is some how good.
  • Diez B. Roggisch at Aug 18, 2009 at 1:15 pm

    ???? ??????? wrote:

    I think i found a good managable solution. Actually it is trivial but
    may help (I used it now).
    When i wnat to access the list then i assign the object which i want
    to access to a variable ex:
    1)x=AutomataBranch()
    2)x=self.cfgAutomata[i]

    The first line is used only to make the IDE knows that x is from
    AutomatBranch type.After that when i press x. then all methods and
    properties are visualized.

    I think it is some how good.
    Unless x=AutomataBranch() is something that is expensive. And to be honest:
    changing code (possibly introducing bugs!!!) to work around short-comings
    in either your IDE or your way you insist to work strikes me as odd.

    I understand the desire to have autocompletion. But it's not *that*
    important. Maybe fabrio (who's maintaining the PyDev-eclipse-plugin) could
    be asked to add something like this:

    #@x:AutomataBranch

    to the plugin - so that when pydev reads that comment, it has a hint on what
    to use for autocompletion.

    Diez

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedAug 17, '09 at 8:47p
activeAug 18, '09 at 1:15p
posts8
users5
websitepython.org

People

Translate

site design / logo © 2022 Grokbase