[EMAIL PROTECTED]
Can someone tell me the difference between single quote and double
quote?
There is no strong reason to use one and avoid the other. Yet, while
representing strings, Python itself has a _preference_ for single
quotes. Programmers can put this duality to good use, by adopting
[Robert Kern]
One habit that seems to crop up, though, is that I will use '' for
internal strings and for strings that will eventually get seen by
the user. Don't ask me why.
One sure thing is that it would help, later, if you ever want to
internationalise a Python program. Not that it
Peter Hansen wrote:
Steven D'Aprano wrote:
It may shock some people to learn that difference in the sense of
mathematical subtraction is not the only meaning of the word, but
there it is. One wouldn't, I hope, misunderstand What is the
difference between spaghetti marinara and spaghetti
On Friday 22 July 2005 08:09 am, François Pinard wrote:
[Robert Kern]
One habit that seems to crop up, though, is that I will use '' for
internal strings and for strings that will eventually get seen by
the user. Don't ask me why.
One sure thing is that it would help, later, if you
[Terry Hancock]
On Friday 22 July 2005 08:09 am, François Pinard wrote:
[Robert Kern]
One habit that seems to crop up, though, is that I will use '' for
internal strings and for strings that will eventually get seen
by the user. Don't ask me why.
One sure thing is that it
François Pinard wrote:
There is no strong reason to use one and avoid the other. Yet, while
representing strings, Python itself has a _preference_ for single
quotes.
I use double quoted strings in almost all cases because I
think it's easier to see than 'single quoted quotes'.
Andrew Dalke said unto the world upon 2005-07-22 13:30:
François Pinard wrote:
There is no strong reason to use one and avoid the other. Yet, while
representing strings, Python itself has a _preference_ for single
quotes.
I use double quoted strings in almost all cases because I
think
[EMAIL PROTECTED] wrote:
Hi,
Can someone tell me the difference between single quote and double
quote?
Thanks
And please settle the dispute between xxx. And xxx.
There was a fellow at Oxford who decided these things but I hear he
went mad.
--
http://mail.python.org/mailman
John Machin wrote:
[EMAIL PROTECTED] wrote:
Can someone tell me the difference between single quote and double
quote?
ord(') - ord('')
5
Very zen.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Can someone tell me the difference between single quote and double
quote?
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
The only difference is when you want to include or ' inside the string. If
you want to include the like quote, then escape it (\, '\''). If you
include the unlike quote, no escape is needed (' or '').
I think that people new to programming will use '' if it is unshifted on their
keyboards.
[EMAIL PROTECTED] wrote:
The only difference is when you want to include or ' inside the string. If
you want to include the like quote, then escape it (\, '\''). If you
include the unlike quote, no escape is needed (' or '').
I think that people new to programming will use '' if it is
Michael Hoffman wrote:
John Machin wrote:
[EMAIL PROTECTED] wrote:
Can someone tell me the difference between single quote and double
quote?
ord(') - ord('')
5
Very zen.
But unfortunately incorrect, since the original poster
didn't ask for the difference between the ordinal
[EMAIL PROTECTED] wrote:
Hi,
Can someone tell me the difference between single quote and double
quote?
There is none. Except that in a double quoted string, single quotes don't
have to be escaped and vice versa, sometimes one of the two forms saves you
some backslashes:
That's my house
Steven D'Aprano wrote:
Michael Hoffman wrote:
John Machin wrote:
[EMAIL PROTECTED] wrote:
Can someone tell me the difference between single quote and double
quote?
ord(') - ord('')
5
Very zen.
But unfortunately incorrect, since the original poster
didn't ask for the difference
Steven D'Aprano wrote:
Michael Hoffman wrote:
John Machin wrote:
[EMAIL PROTECTED] wrote:
Can someone tell me the difference between single quote and double
quote?
ord(') - ord('')
5
Very zen.
But unfortunately incorrect, since the original poster
didn't ask for the difference between
what is the difference between command prompt and IDLE?
--
http://mail.python.org/mailman/listinfo/python-list
start reading here: http://www.python.org/idle/doc/idlemain.html,
although it is not up to date most of the information still holds up
--
http://mail.python.org/mailman/listinfo/python-list
' object but received a 'list'
So why TypeError raised?
and
What's the difference between str and 'hello' ?
Thanks a lot.
--
http://mail.python.org/mailman/listinfo/python-list
Am Donnerstag, 19. Mai 2005 11:27 schrieb hong Yu:
str.join(a)
Traceback (most recent call last):
File stdin, line 1, in ?
TypeError: descriptor 'join' requires a 'str' object but received a 'list'
What's the difference between str and 'hello' ?
str.join(,a) = .join
: descriptor 'join' requires a 'str' object but received a
'list'
So why TypeError raised?
and
What's the difference between str and 'hello' ?
Thanks a lot.
str is a class, 'hello' is instance of the class; the method join
expects to receive an instance as its first parameter so:-
str.join
After an hour of research, I'm more confused than ever. I don't know
if I should use the time module, or the eGenix datetime module. Here's
what I want to do: I want to calculate the time difference (in
seconds would be okay, or minutes), between two date-time strings.
so: something like this:
Stewart Midwinter wrote:
After an hour of research, I'm more confused than ever. I don't know
if I should use the time module, or the eGenix datetime module. Here's
what I want to do: I want to calculate the time difference (in
seconds would be okay, or minutes), between two date-time
On Sun, 8 May 2005 19:06:31 -0600, Stewart Midwinter [EMAIL PROTECTED] wrote:
After an hour of research, I'm more confused than ever. I don't know
if I should use the time module, or the eGenix datetime module. Here's
what I want to do: I want to calculate the time difference (in
seconds would be
thanks Robert, those 4 lines of code sure beat the 58 of my
home-rolled time-date function!
cheers
S
--
http://mail.python.org/mailman/listinfo/python-list
Dear all,
I have a project that is conversion
of Php Web applications into Python cgi
applications. In my mind compare python-cgi
php is better. But I want to know clearly.
which one is better. so kindly show me the
advantages of python-cgi compare to Php
regards
PRaba
Praba == praba kar [EMAIL PROTECTED] writes:
Praba Dear all,
Praba I have a project that is conversion of Php Web applications
Praba into Python cgi applications. In my mind compare
You might want to look into mod_python and psp (python server pages)
for a more straightforward
What's the difference between these 2 statements?
If you have a String s=12345
s[len(s)::-1] = 54321
But
s[len(s):0:-1] = 5432
Why? What's the difference? What number then can I use as the end of
the slice if I were to supply all 3 parameters?
Thanks,
AT
--
http://mail.python.org/mailman
Reinhold Birkenfeld wrote:
ATSkyWalker wrote:
What's the difference between these 2 statements?
If you have a String s=12345
s[len(s)::-1] = 54321
But
s[len(s):0:-1] = 5432
Why? What's the difference? What number then can I use as the end of
the slice if I were to supply all 3 parameters?
-1
ATSkyWalker wrote:
What's the difference between these 2 statements?
If you have a String s=12345
s[len(s)::-1] = 54321
But
s[len(s):0:-1] = 5432
Why? What's the difference? What number then can I use as the end of
the slice if I were to supply all 3 parameters?
-1.
Reinhold
s[len(s):-1:-1] yields an empty list !
Test code :
s = 12345
print s[len(s)::-1] - prints 54321
print s[len(s):-1:-1] - prints (nothing)
--
http://mail.python.org/mailman/listinfo/python-list
tiissa wrote:
Reinhold Birkenfeld wrote:
ATSkyWalker wrote:
What's the difference between these 2 statements?
If you have a String s=12345
s[len(s)::-1] = 54321
But
s[len(s):0:-1] = 5432
Why? What's the difference? What number then can I use as the end of
the slice if I were to supply all
I'm sorry, I'm not really following your logic. Can you supply the
statement with the three parameters ?
so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be
or is it impossible to express it in this way ?
Thanks,
AT
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be
or is it impossible to express it in this way ?
This does not work for integers, because the theoretically correct value
x = -1 already has another interpretation as the gap between the last and
Peter,
I like the way you put it the gap between the last and
the last but one character :-).
I guess this is a side effect of of python's asymetric slice indexing
approach which takes a little getting used to.
AT
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
I'm sorry, I'm not really following your logic. Can you supply the
statement with the three parameters ?
so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be
or is it impossible to express it in this way ?
Contrary to what I said above x should be
Peter Otten wrote:
[EMAIL PROTECTED] wrote:
so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be
or is it impossible to express it in this way ?
This does not work for integers, because the theoretically correct value
x = -1 already has another interpretation as the gap
tiissa wrote:
Peter Otten wrote:
[EMAIL PROTECTED] wrote:
so if I want to reverse it fully using s[len(s)-1:x:-1] what would x be
or is it impossible to express it in this way ?
This does not work for integers, because the theoretically correct value
x = -1 already has another
Peter Otten wrote:
Still, for practical purposes you have to test for slicelen = stringlen, so
whether you choose None, -len(s)-1, or -sys.maxint as the second slice
parameter doesn't matter much.
Sure, for practical purposes you don't bother to write extra characters
and leave it void.
But we
Op 2005-02-17, Diez B. Roggisch schreef [EMAIL PROTECTED]:
John wrote:
... hmm... bound methods get created each time you make
a call to an instance method via an instance of the given class?
No, they get created when you create an actual instance of an object.
I'm not so sure about that.
John wrote:
inst = C()
f1 = inst.foo
f2 = inst.foo
f1, f2
(bound method C.foo of __main__.C instance at 0x00B03F58, bound
method C.foo of __main__.C instance at 0x00B03F58)
I just wanted to interject, although those two hex
numbers in the above line are the same, calling
id() on f1 and
Diez B. Roggisch wrote:
This is badly wrong. John was correct.
Bound methods get created whenever you reference a method of an
instance. If you are calling the method then the bound method is
destroyed as soon as the call returns. You can have as many different
bound methods created from
Op 2005-02-18, Diez B. Roggisch schreef [EMAIL PROTECTED]:
This is badly wrong. John was correct.
Bound methods get created whenever you reference a method of an instance.
If you are calling the method then the bound method is destroyed as soon
as the call returns. You can have as many
John M. Gabriele wrote:
I've done some C++ and Java in the past, and have recently learned
a fair amount of Python. One thing I still really don't get though
is the difference between class methods and instance methods. I
guess I'll try to narrow it down to a few specific questions, but
any
Duncan Booth wrote:
John M. Gabriele wrote:
I've done some C++ and Java in the past, and have recently learned
a fair amount of Python. One thing I still really don't get though
is the difference between class methods and instance methods. I
guess I'll try to narrow it down to a few specific
John wrote:
... hmm... bound methods get created each time you make
a call to an instance method via an instance of the given class?
No, they get created when you create an actual instance of an object. So
only at construction time. Creating them means taking the unbound method
and binding the
Diez B. Roggisch wrote:
John wrote:
... hmm... bound methods get created each time you make
a call to an instance method via an instance of the given class?
No, they get created when you create an actual instance of an object. So
only at construction time. Creating them means taking the unbound
O. Unlike C++, where methods are not first class objects
and you only have *one* that gets shared by all instances.
Exactly - so unlike in c++, where you have to do ugly hacks if e.g. a C-lib
takes a callback and you want to pass an instance method, you can do that
in python. It's
, assuming they're not wrapped with anything.)
Consider the difference between str.join and ''.join:
py str.join
method 'join' of 'str' objects
py ', '.join
built-in method join of str object at 0x01233620
Hmm... weird.
Ok, the point here is that str.join and ', '.join are not the same
object
Diez B. Roggisch wrote:
John wrote:
... hmm... bound methods get created each time you make
a call to an instance method via an instance of the given class?
No, they get created when you create an actual instance of an object.
So only at construction time. Creating them means taking the
Duncan Booth wrote:
[snip]
Bound methods get created whenever you reference a method of an instance.
If you are calling the method then the bound method is destroyed as soon as
the call returns. You can have as many different bound methods created from
the same unbound method and the same
I've done some C++ and Java in the past, and have recently learned
a fair amount of Python. One thing I still really don't get though
is the difference between class methods and instance methods. I
guess I'll try to narrow it down to a few specific questions, but
any further input offered
that has been associated with a specific instance, and an
unbound method is an instance method that has not been associated with
a specific instance. Consider the difference between str.join and ''.join:
py str.join
method 'join' of 'str' objects
py ', '.join
built-in method join of str object
901 - 953 of 953 matches
Mail list logo