Michael Langford wrote:
>> Not sure how you would do that with unit tests?
>
> You write unit tests for each of your functions that test their input
> and output. Presumably, if you used a float somewhere in the middle
> there, when you don't use the float in the java implementation, you'll
> get
Toby wrote:
> What I'm saying is if I have used a certain variable to hold literally
> dozens of different values and I BELIEVE them all to be integers but I'm not
> entirely sure that I have not stumbled into the float realm is there a way
> to have python list all variables contained in a program
> - Since the OP is trying to find cases where the same variable is
> assigned different types, presumably in a single scope, checking just at
> the end of a function won't help.
This is a starting point to get the type for the variables when you
start the port, before you run the unit tests.
Tiger12506 wrote:
> Hehehe, did you try it Kent?
Obviously not :-)
> Which is not what I expected!
> Until I realized that you are missing the % sign in between the print string
> and the tuple of values to interpolate
Blame that one on Michael, I copied from him :-)
> Then it returns this:
>
> I was thinking more or less along the same lines, but
> - you don't need the copy()
Hehehe, did you try it Kent?
> - locals is a dict mapping names to values, so something like
> for name, value in locals().iteritems():
> print "varname: %s type: %s" (name,type(value))
And this returns
> As I understand it python is not a strongly typed language so no
> declaration
> of variables is necessary. My question is this:
>
> If I use a variable in a program that stores certain numbers and I'm
> porting
> it to say ... java where I must first declare the variables before I use
> them
Michael Langford wrote:
>you can
> print out the type of the local variables at the end of your
> functions.
>
> i.e.:
>
> for var in locals().copy():
> print "varname: %s type: %s" (var,type(var))
I was thinking more or less along the same lines, but
- you don't need the copy()
- locals is
On Wed, Feb 20, 2008 at 12:41 PM, Toby <[EMAIL PROTECTED]> wrote:
> I have used a certain variable to hold literally
> dozens of different values and I BELIEVE them all to be integers but I'm not
> entirely sure that I have not stumbled into the float realm is there a way
> to have python list a
Toby wrote:
> As I understand it python is not a strongly typed language so no declaration
> of variables is necessary.
Actually Python has strong, dynamic typing but I guess that is a
discussion for another thread.
> If I use a variable in a program that stores certain numbers and I'm porting
>
As I understand it python is not a strongly typed language so no declaration
of variables is necessary. My question is this:
If I use a variable in a program that stores certain numbers and I'm porting
it to say ... java where I must first declare the variables before I use
them how do I find out
10 matches
Mail list logo