def MoveShip(ship,x,y): ....code.... ship.posX=x; ship.posY=y; ....code....Now, if "ship" does not have a "posX" attribute, the function will throw an exception in the middle of it.
Now this:
def MoveShip(ship,x,y): x=float(x); y=float(Y); ship=Ship(ship); ...code... ship.posX=x; ...code....It seems to me this solves various problems:
1)Does "pre-emptive" type checking before the actual function begins to execute
2)Automatically converts "compatible" types
3)You get easier "smart complete" in various editors, whereas it would be more difficult to get it in local variables with uknown types.
There is of course the issue of having to create a new object, so the method should be treaded with some moderation.
What do you think?