Hello all ,
I am trying some interactive examples here where i have come across
inconsistencies??? :O
Anyway heres whats bothering me
>>> s = 'hello'
>>> s[0]
'h'
>>> s[:]
'hello'
>>> m = s[:]
>>> m
'hello'
>>> m is s
True
I discussed the *is* operator with some of the pythoners before as
well
Ishwor wrote:
s = 'hello'
m = s[:]
m is s
True
I discussed the *is* operator with some of the pythoners before as
well but it is somewhat different than what i intended it to do. The
LP2E by Mark & David says -
" m gets a *full top-level copy* of a sequence object- an object with
the same value bu
On Sun, 05 Dec 2004 09:44:13 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:
[snip]
>
> This behaviour is due to the way strings are handled. In some cases strings
> are 'interned' which
> lets the interpreter keep only a single copy of a string. If you try it with
> a list you get a
> differen
Ishwor wrote:
On Sun, 05 Dec 2004 09:44:13 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:
This behaviour is due to the way strings are handled. In some cases strings are
'interned' which
lets the interpreter keep only a single copy of a string. If you try it with a
list you get a
different result
Ishwor wrote:
> I am trying some interactive examples here where i have come across
> inconsistencies??? :O
obsession with implementation artifacts is a premature optimization,
and should be avoided.
> Anyway heres whats bothering me
>
s = 'hello'
s[0]
> 'h'
s[:]
> 'hello'
m
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
>
> Ishwor wrote:
>
> > I am trying some interactive examples here where i have come across
> > inconsistencies??? :O
>
> obsession with implementation artifacts is a premature optimization,
> and should be avoided.
[snip]
> a suggestion: if you rea
On Sun, 05 Dec 2004 10:31:12 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote:
>
> "Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
> > a suggestion: if you really want to be productive in python, forget about
> > "is" for a while.
I know what Fredrik means here (Thanx Frederick :) ) but IMHO if the
pa
Ishwor <[EMAIL PROTECTED]> wrote:
>
> On Sun, 05 Dec 2004 10:31:12 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote:
> >
> > "Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
>
> > > a suggestion: if you really want to be productive in python, forget about
> > > "is" for a while.
>
> I know what Fredr
I didn't mean to be extremely rude. Just a little bit..~:-). sorry.
On Sun, 05 Dec 2004 12:09:22 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote:
>
[snip]
>
> Goodness, you got right snippy with the 'intellectual property' thing.
> I'm sorry if it sounded as if I had meant "I came up with this
On Sun, 5 Dec 2004 17:07:47 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> a suggestion: if you really want to be productive in python, forget about
> "is" for a while. good code doesn't copy stuff much, either, by the way.
> python's all about objects, and things that hold references to object
I've written a program that takes a phrase and spits it back out
backwards. My problem is it throws each character on a new line. I'd
like the phrase to be on the same line. Is this possible?
#Backward Message
message = raw_input("Enter a message: ")
letter = len(message)
while (letter > 0):
add a dash like shown below
>>> print newMessage,
--
http://mail.python.org/mailman/listinfo/python-list
Wow - thats simple =). Thanks a ton!!
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 23 Feb 2006 14:55:16 -0800, DannyB wrote:
> I've written a program that takes a phrase and spits it back out
> backwards. My problem is it throws each character on a new line. I'd
> like the phrase to be on the same line. Is this possible?
First suggestion: Put a comma at the end of th
DannyB wrote:
> I've written a program that takes a phrase and spits it back out
> backwards. My problem is it throws each character on a new line. I'd
> like the phrase to be on the same line. Is this possible?
>
> #Backward Message
>
> message = raw_input("Enter a message: ")
> letter = len
Dennis Lee Bieber wrote:
> On Thu, 23 Feb 2006 18:06:46 -0600, Larry Bates
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
>
>> Better was is:
>>
>> message = raw_input("Enter a message: ")
>> print message[::-1]
>>
>
> I sometimes get the feeling a lot of responses t
16 matches
Mail list logo