Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Strongly typed list

Reply
Thread Tools

Strongly typed list

 
 
هاني الموصلي
Guest
Posts: n/a
 
      08-17-2009
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.
 
Reply With Quote
 
 
 
 
Fabio Zadrozny
Guest
Posts: n/a
 
      08-17-2009
> 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
 
Reply With Quote
 
 
 
 
هاني الموصلي
Guest
Posts: n/a
 
      08-17-2009
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.....
 
Reply With Quote
 
Jonathan Gardner
Guest
Posts: n/a
 
      08-18-2009
On Aug 17, 2:19*pm, هاني الموصلي <(E-Mail Removed)> 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.
 
Reply With Quote
 
Diez B. Roggisch
Guest
Posts: n/a
 
      08-18-2009
هاني الموصلي 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
 
Reply With Quote
 
Albert Hopkins
Guest
Posts: n/a
 
      08-18-2009
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


 
Reply With Quote
 
هاني الموصلي
Guest
Posts: n/a
 
      08-18-2009
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.
 
Reply With Quote
 
Diez B. Roggisch
Guest
Posts: n/a
 
      08-18-2009
هاني الموصلي 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Namespace For Strongly Typed DataSet Narayanan Sankaranarayanan ASP .Net 0 12-15-2004 01:28 AM
Strongly Typed Collection - sort in DataGrid Mark ASP .Net 1 09-22-2004 07:13 PM
Help with creating strongly typed DataSet =?Utf-8?B?QW5kcmUgUmFuaWVyaQ==?= ASP .Net 1 04-19-2004 12:42 AM
Strongly typed datasets and XML Big D ASP .Net 1 02-17-2004 11:32 PM
Strongly Typed dataset Imran ASP .Net 1 01-23-2004 07:42 AM



Advertisments