Tkinter: The good, the bad, and the ugly!

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Dec 30 14:51:48 EST 2010


On Thu, 30 Dec 2010 07:24:04 -0800, rantingrick wrote:

> Also one could argue that C and Python are very similar.

One could also argue that black is white, that diamond is softer than 
chalk, and that bananas are a type of spaceship. Doesn't make it so.

How to add two numbers in C:

#include <stdio.h>
int main()
{
   int a, b;
   scanf("%d%d", &a, &b);
   printf("%d\n", a + b);
   return 0;
}

And in Python:

a, b = input().split()  # use raw_input in Python 2
print(int(a) + int(b))


And in Tcl:

scan [gets stdin] "%d %d" x y
puts [expr {$x + $y}]


None of the three are exactly clones of each other, but it seems to me 
that Tcl and Python are quite close in spirit, if not syntax.


-- 
Steven





More information about the Python-list mailing list