Contexts for If/Loops
Alexander Dymo
dymo at ukrpost.ua
Thu Aug 23 12:26:17 UTC 2007
On 8/23/07, Andreas Pakulat <apaku at gmx.de> wrote:
> On 23.08.07 03:56:46, Piyush Verma wrote:
> > Is it valid/usable to have separate contexts for the IF / while/ For/ try
> > blocks in Python.?
>
> No only Python but also C++, so far I don't think this is happening for
> C++ and I wonder how code-completion works for objects created inside an
> if-block...
My understanding of contexts was that it is roughly the "{}" block in
c++ code - the scope where variables are defined. If that's true then
if/while/for ... should have their own contexts.
But for ruby for example the variable first used inside if/while/etc.
is still declared/defined after the statement:
if something
a = 2
end
#here "a" is defined and has either value nil or 2 depending on
whether something false or true
puts a
So I wonder whether python has the same rule.
More information about the KDevelop-devel
mailing list