Re: Difference between and '

2005-07-22 Thread François Pinard
[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

Re: Difference between and '

2005-07-22 Thread François Pinard
[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

Re: Difference between and '

2005-07-22 Thread John Machin
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

Re: Difference between and '

2005-07-22 Thread 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 would help, later, if you

Re: Difference between and '

2005-07-22 Thread François Pinard
[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

Re: Difference between and '

2005-07-22 Thread Andrew Dalke
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'.

Re: Difference between and '

2005-07-22 Thread Brian van den Broek
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

Re: Difference between and '

2005-07-21 Thread muldoon
[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

Re: Difference between and '

2005-07-21 Thread Michael Hoffman
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

Difference between and '

2005-07-21 Thread [EMAIL PROTECTED]
Hi, Can someone tell me the difference between single quote and double quote? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between and '

2005-07-21 Thread jepler
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.

Re: Difference between and '

2005-07-21 Thread Robert Kern
[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

Re: Difference between and '

2005-07-21 Thread Steven D'Aprano
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

Re: Difference between and '

2005-07-21 Thread Benjamin Niemann
[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

Re: Difference between and '

2005-07-21 Thread Robert Kern
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

Re: Difference between and '

2005-07-21 Thread Benji York
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?

2005-07-03 Thread shisa
what is the difference between command prompt and IDLE? -- http://mail.python.org/mailman/listinfo/python-list

Re: what is the difference between command prompt and IDLE?

2005-07-03 Thread [EMAIL PROTECTED]
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

What's the difference between str and 'hello' ?

2005-05-19 Thread hong Yu
' 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

Re: What's the difference between str and 'hello' ?

2005-05-19 Thread Heiko Wundram
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

Re: What's the difference between str and 'hello' ?

2005-05-19 Thread paulC
: 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

how to calc the difference between two datetimes?

2005-05-08 Thread Stewart Midwinter
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:

RE: how to calc the difference between two datetimes?

2005-05-08 Thread Robert Brewer
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

Re: how to calc the difference between two datetimes?

2005-05-08 Thread Jp Calderone
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

Re: how to calc the difference between two datetimes?

2005-05-08 Thread Stewart Midwinter
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

Difference between Python CGI applications and Php applications

2005-05-04 Thread praba kar
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

Re: Difference between Python CGI applications and Php applications

2005-05-04 Thread Ville Vainio
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?

2005-04-20 Thread ATSkyWalker
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

Re: What's the difference between these 2 statements?

2005-04-20 Thread tiissa
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

Re: What's the difference between these 2 statements?

2005-04-20 Thread Reinhold Birkenfeld
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

Re: What's the difference between these 2 statements?

2005-04-20 Thread ahmedt
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

Re: What's the difference between these 2 statements?

2005-04-20 Thread Reinhold Birkenfeld
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

Re: What's the difference between these 2 statements?

2005-04-20 Thread ahmedt
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

Re: What's the difference between these 2 statements?

2005-04-20 Thread Peter Otten
[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

Re: What's the difference between these 2 statements?

2005-04-20 Thread ATSkyWalker
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

Re: What's the difference between these 2 statements?

2005-04-20 Thread tiissa
[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

Re: What's the difference between these 2 statements?

2005-04-20 Thread tiissa
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

Re: What's the difference between these 2 statements?

2005-04-20 Thread Peter Otten
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

Re: What's the difference between these 2 statements?

2005-04-20 Thread tiissa
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

Re: difference between class methods and instance methods

2005-02-18 Thread Antoon Pardon
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.

Re: difference between class methods and instance methods

2005-02-18 Thread Duncan Booth
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

Re: difference between class methods and instance methods

2005-02-18 Thread Duncan Booth
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

Re: difference between class methods and instance methods

2005-02-18 Thread Antoon Pardon
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

Re: difference between class methods and instance methods

2005-02-17 Thread Duncan Booth
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

Re: difference between class methods and instance methods

2005-02-17 Thread John
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

Re: difference between class methods and instance methods

2005-02-17 Thread Diez B. Roggisch
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

Re: difference between class methods and instance methods

2005-02-17 Thread John
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

Re: difference between class methods and instance methods

2005-02-17 Thread Diez B. Roggisch
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

Re: difference between class methods and instance methods

2005-02-17 Thread Steven Bethard
, 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

Re: difference between class methods and instance methods

2005-02-17 Thread Duncan Booth
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

Re: difference between class methods and instance methods

2005-02-17 Thread John
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

difference between class methods and instance methods

2005-02-16 Thread John M. Gabriele
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

Re: difference between class methods and instance methods

2005-02-16 Thread Steven Bethard
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

<    5   6   7   8   9   10