Re: The use of type()

2019-02-10 Thread ^Bart
a = 5 print(a.__class__.__name__) int b = 5.0 print(b.__class__.__name__) float Thank you very much! :) ^Bart -- https://mail.python.org/mailman/listinfo/python-list

RE: The use of type()

2019-02-10 Thread Avi Gross
then within that for the name like this: >>> a = 5 >>> print(a.__class__.__name__) int >>> b = 5.0 >>> print(b.__class__.__name__) float -Original Message- From: Python-list On Behalf Of Avi Gross Sent: Sunday, February 10, 2019 5:43 PM To: python-lis

RE: The use of type()

2019-02-10 Thread Avi Gross
Without using regular expressions, if you just want to extract the word "int" or "float" you can substring the results by converting what type says to a string: >>> a = 5 >>> str(type(a))[8:11] 'int' >>> a=5.0 >>> str(type(a))[8:13] 'float' Since the format and length vary, this may not meet you

Re: The use of type()

2019-02-10 Thread Chris Angelico
On Mon, Feb 11, 2019 at 8:46 AM ^Bart wrote: > > I need to print something like "this variable is int" or "this variable > is string" > > n1 = 10 > n2 = 23 > > print ("Total of n1+n2 is: ",n1+n2," the type is", type(n1+n2)) > > When I run it I have: > > Total of n1+n2 is: 33 the type is > >>>

Re: The use of universal_newlines in subprocess

2007-05-22 Thread Gabriel Genellina
En Tue, 22 May 2007 12:00:48 -0300, Joel Andres Granados <[EMAIL PROTECTED]> escribió: > I have been working with the universal_newlines option that can be > specified while using the subprocess module. I'm calling an app that > uses sys.stdout.write('\r'+' '*80) to manage its stdout. The sit

Re: The use of :

2004-11-30 Thread Nick Coghlan
BJörn Lindqvist wrote: Because it contains more non-significant symbols (, ), { and } that "steal" the programmers attention. But consider def f(x, y, z) print x, y, z to def f(x, y, z): print x, y, z IMHO, the colon-less variant is more readable than the one with the colon. Except that i

Re: The use of :

2004-11-29 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, bruno modulix wrote: > > In fact, from a purely technical POV, the ':' could have been omitted > from the Python syntax, since indentation does the whole job of defining > blocks. It's only here for readability AFAIK. > The ':' serves as a very good hint to "python awa

Re: The use of :

2004-11-28 Thread Paul Robson
On Mon, 29 Nov 2004 01:12:16 -0500, Jeremy Bowers wrote: > The only punctuation you *need* is whitespace. See Forth (I don't know > if this is perfect but I'd bet the transform is simple), : Announce ." Forth has a fair bit of punctuation" ; -- http://mail.python.org/mailman/listinfo/python-list

Re: The use of :

2004-11-28 Thread Jeremy Bowers
A two-fer. On Mon, 29 Nov 2004 10:28:42 +0800, Isaac To wrote: >> "Greg" == Greg Ewing <[EMAIL PROTECTED]> writes: > > >> The only punctuation you *need* is whitespace. See Forth > > Greg> You don't even need that... see FORTRAN. :-) Well, I for one don't like reading large program

Re: The use of :

2004-11-28 Thread Isaac To
> "Greg" == Greg Ewing <[EMAIL PROTECTED]> writes: >> The only punctuation you *need* is whitespace. See Forth Greg> You don't even need that... see FORTRAN. :-) And you don't need everything else either... see this. http://compsoc.dur.ac.uk/whitespace/ :-) Regard

Re: The use of :

2004-11-28 Thread Greg Ewing
Jeremy Bowers wrote: The only punctuation you *need* is whitespace. See Forth You don't even need that... see FORTRAN. :-) DOI=1TO10-ly, -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/

Re: The use of :

2004-11-28 Thread Michael Sparks
On Sun, 28 Nov 2004, [ISO-8859-1] BJörn Lindqvist wrote: > In the faq, > http://www.python.org/doc/faq/general.html#why-are-colons-required-for-the-if-while-def-class-statements, > it is stated that the colon is there "primarily to enhance readability > (one of the results of the experimental ABC