|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
undetermine typedef hello (rcptto) :
assert(isinstance(rcptto, list)) listrcpt = rcptto[:] The listrcpt is also marked as undetermine type in the sample above. The ide needs to detect this kind of usage. _________________________________________________ Wing IDE users list http://wingware.com/lists/wingide |
|
|
Re: undetermine typeOn Fri, Jul 4, 2008 at 9:56 AM, Marcus Low <marcus@...> wrote:
> def hello (rcptto) : > assert(isinstance(rcptto, list)) listrcpt = rcptto[:] > The listrcpt is also marked as undetermine type in the sample above. The ide > needs to detect this kind of usage. > How it should? Asserting something is a istance of list doesn't mean that in the line below you will use the variable as one. By the way this code breaks if rcptto is not a list but something with slicing support. -- Lawrence, stacktrace.it - oluyede.org - neropercaso.it "It is difficult to get a man to understand something when his salary depends on not understanding it" - Upton Sinclair _________________________________________________ Wing IDE users list http://wingware.com/lists/wingide |
|
|
Re: undetermine type listrcpt = rcptto[:]
This is valid list copy. The statement "assert(isinstance(rcptto, list))" is only added there to HELP wing-ide to recognize that rcptto is a list. Else i wont be bother putting it. Now if wing-ide recognize now that rcptto is a LIST then my next statement "listrcpt = rcptto[:]" should be recognize as well. If i am not using listrcpt as a list here, i dont know what other possible use you are talking about given just those codes. >By the way this code breaks if rcptto is not a list but something with >licing support. I already said the "assert" is for the sake of the IDE and the user of this function gurantees its a list. I hope you are in the right forum. Lawrence Oluyede wrote: > On Fri, Jul 4, 2008 at 9:56 AM, Marcus Low <marcus@...> wrote: > >> def hello (rcptto) : >> assert(isinstance(rcptto, list)) listrcpt = rcptto[:] >> The listrcpt is also marked as undetermine type in the sample above. The ide >> needs to detect this kind of usage. >> >> > > How it should? Asserting something is a istance of list doesn't mean > that in the line below you will use the variable as one. > By the way this code breaks if rcptto is not a list but something with > slicing support. > > _________________________________________________ Wing IDE users list http://wingware.com/lists/wingide |
|
|
Re: undetermine typeOn Fri, Jul 4, 2008 at 10:33 AM, Marcus Low <marcus@...> wrote:
> listrcpt = rcptto[:] > > This is valid list copy. The statement "assert(isinstance(rcptto, list))" is > only added there to HELP wing-ide to recognize that rcptto is a list. Else i > wont be bother putting it. > Now if wing-ide recognize now that rcptto is a LIST then my next statement > "listrcpt = rcptto[:]" should be recognize as well. > If i am not using listrcpt as a list here, i dont know what other possible > use you are talking about given just those codes. > I think I did not explain myself correctly. I think WingIDE can infer if a variable is "something" by how you initialize it. I doubt that asserting something will help hi. I'd try with listrcpt = list(rcptto) without the assert -- Lawrence, stacktrace.it - oluyede.org - neropercaso.it "It is difficult to get a man to understand something when his salary depends on not understanding it" - Upton Sinclair _________________________________________________ Wing IDE users list http://wingware.com/lists/wingide |
|
|
Re: undetermine typeMarcus Low wrote:
> def hello (rcptto) : > assert(isinstance(rcptto, list)) listrcpt = rcptto[:] > The listrcpt is also marked as undetermine type in the sample above. The > ide needs to detect this kind of usage. Yes, I believe Wing is missing x = y[:] as an inferencing opportunity. We hope to improve this in the future. Note that x = list(y) would work in this case but of course isn't helpful if you want something like x = y[:-3] -- Stephan Deibel Wingware | Python IDE Advancing Software Development www.wingware.com _________________________________________________ Wing IDE users list http://wingware.com/lists/wingide |
|
|
Re: undetermine typeOn Fri, Jul 4, 2008 at 3:21 PM, Wingware Support <support@...> wrote:
> Yes, I believe Wing is missing x = y[:] as an inferencing opportunity. We > hope > to improve this in the future. Note that x = list(y) would work in this > case > but of course isn't helpful if you want something like x = y[:-3] Yep. I used list() because [:] does the same. Create a copy of the list. Otherwise if the list is modified afterwards also the reference passed would. Just assumed the behavior :) -- Lawrence, stacktrace.it - oluyede.org - neropercaso.it "It is difficult to get a man to understand something when his salary depends on not understanding it" - Upton Sinclair _________________________________________________ Wing IDE users list http://wingware.com/lists/wingide |
|
|
Re: undetermine typeHi,
Is there a way to manually add this to the IDe, somekind of config file or macro? I mean putting things like assert(isinstance, and changing coding style to fit the ide is kinda weird lingo to me, coming from VS environment. The are many styles in python i wish to use as is and which i really do like the style for eg : l = o[:] instead of l = list(o) l = (1,2,3) instead of l = tuple((1,2,3)) - but of course isn't helpful if you want something like x = y[:-3] exactly, the [] is used so naturally in python that i would rather stick to that then changing for the ide sake. At the end of the day, its makes a difference when i am reading the whole code. Marcus. Lawrence Oluyede wrote: > On Fri, Jul 4, 2008 at 3:21 PM, Wingware Support <support@...> wrote: > >> Yes, I believe Wing is missing x = y[:] as an inferencing opportunity. We >> hope >> to improve this in the future. Note that x = list(y) would work in this >> case >> but of course isn't helpful if you want something like x = y[:-3] >> > > Yep. I used list() because [:] does the same. Create a copy of the list. > Otherwise if the list is modified afterwards also the reference passed would. > Just assumed the behavior :) > > _________________________________________________ Wing IDE users list http://wingware.com/lists/wingide |
|
|
Re: undetermine typeMarcus Low wrote:
> Is there a way to manually add this to the IDe, somekind of config file > or macro? I mean putting things like assert(isinstance, and changing > coding style to fit the ide is kinda weird lingo to me, coming from VS > environment. This is something that requires modification to the source analyzer and is not something that can be done through a config file or a script. We do know of this limitation and that you (& others) would like to see it fixed; we'll try to fix it in a future release. Thanks, John _________________________________________________ Wing IDE users list http://wingware.com/lists/wingide |
| Free Forum Powered by Nabble | Forum Help |