Strongly typed list

Discussion in 'Python' started by هاني الموصلي, Aug 17, 2009.

  1. 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.
     
    هاني الموصلي, Aug 17, 2009
    #1
    1. Advertising

  2. > 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
     
    Fabio Zadrozny, Aug 17, 2009
    #2
    1. Advertising

  3. 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.....
     
    هاني الموصلي, Aug 17, 2009
    #3
  4. 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.
     
    Jonathan Gardner, Aug 18, 2009
    #4
  5. هاني الموصلي 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
     
    Diez B. Roggisch, Aug 18, 2009
    #5
  6. 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
     
    Albert Hopkins, Aug 18, 2009
    #6
  7. 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

    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.
     
    هاني الموصلي, Aug 18, 2009
    #7
  8. هاني الموصلي 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
    >
    > 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
     
    Diez B. Roggisch, Aug 18, 2009
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Narayanan Sankaranarayanan

    Custom Namespace For Strongly Typed DataSet

    Narayanan Sankaranarayanan, Dec 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,101
    Narayanan Sankaranarayanan
    Dec 15, 2004
  2. Imran

    Strongly Typed dataset

    Imran, Jan 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    589
    Richard A. Lowe
    Jan 23, 2004
  3. Big D

    Strongly typed datasets and XML

    Big D, Feb 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    475
    bruce barker
    Feb 17, 2004
  4. =?Utf-8?B?QW5kcmUgUmFuaWVyaQ==?=

    Help with creating strongly typed DataSet

    =?Utf-8?B?QW5kcmUgUmFuaWVyaQ==?=, Apr 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    559
    Rick Strahl [MVP]
    Apr 19, 2004
  5. Mark
    Replies:
    1
    Views:
    1,157
    =?Utf-8?B?RGVtZXRyaQ==?=
    Sep 22, 2004
Loading...

Share This Page