The following forum message was posted by johnnymta at 
http://sourceforge.net/projects/pydev/forums/forum/293649/topic/3853655:

It seems like I can't refactor->extract method for a method that has a return
statement in it.
I get a dialog box saying "Selection may not contain a(n) Return statement (Line
x,y)"

Why is that?
It is very simple to refactor a selection that has a return value: simply return
the extracted method's value in the original code.

e.g.
[code]
def long_method:
    if a == 0:
         doSomething
         doSomethingElse
         calculateStuff
         return calculatedStuff
    else:
         doDifferentThings
         calculateDifferentStuff
         return differentCalculatedStuff
[/code]

becomes:

[code]
def long_method:
    if a == 0:
         return firstExtractedMethod
    else:
         return secondExtractedMethod
[/code]


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Pydev-users mailing list
Pydev-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pydev-users

Reply via email to