On 7/1/2010 12:32 AM, Mladen Gogala wrote:
On Wed, 30 Jun 2010 21:04:28 -0700, Stephen Hansen wrote:
However, you can easily get what you want by using the 'reversed'
function (and similarly, the 'sorted' function), a la:
y = ''.join(reversed(list(x)))
The 'reversed' and 'sorted'
On 7/1/10 12:45 AM, Terry Reedy wrote:
On 7/1/2010 12:32 AM, Mladen Gogala wrote:
On Wed, 30 Jun 2010 21:04:28 -0700, Stephen Hansen wrote:
However, you can easily get what you want by using the 'reversed'
function (and similarly, the 'sorted' function), a la:
y =
Terry Reedy tjre...@udel.edu writes:
sequential statements are a form of composition, even if
strict functionalists do not like to see it that way.
They actually do like to see it that way:
http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html
--
On 1 Jul., 06:04, Stephen Hansen me+list/pyt...@ixokai.io wrote:
The 'reversed' and 'sorted' functions are generators that lazilly
convert an iterable as needed.
'sorted' returns a new list (and is not lazy).
--
http://mail.python.org/mailman/listinfo/python-list
On 7/1/10 5:29 AM, Wolfram Hinderer wrote:
On 1 Jul., 06:04, Stephen Hansenme+list/pyt...@ixokai.io wrote:
The 'reversed' and 'sorted' functions are generators that lazilly
convert an iterable as needed.
'sorted' returns a new list (and is not lazy).
Oops, you're right. Got the two crossed
Zubin Mithra wrote:
Er, I don't think you thought that one entirely through (/ tried it
out):
My Apologies.
Here is a working one.
x=123
t = list(x)
t.reverse()
print ''.join(t)
321
But of course, the method which was suggested earlier is far more elegant.
print
On 7/1/2010 3:54 AM, Stephen Hansen wrote:
On 7/1/10 12:45 AM, Terry Reedy wrote:
On 7/1/2010 12:32 AM, Mladen Gogala wrote:
On Wed, 30 Jun 2010 21:04:28 -0700, Stephen Hansen wrote:
However, you can easily get what you want by using the 'reversed'
function (and similarly, the 'sorted'
If I write things with the intermediate variables like below, everything
works:
x=quick brown fox jumps over a lazy dog
y=list(x)
y
['q', 'u', 'i', 'c', 'k', ' ', 'b', 'r', 'o', 'w', 'n', ' ', 'f', 'o',
'x', ' ', 'j', 'u', 'm', 'p', 's', ' ', 'o', 'v', 'e', 'r', ' ', 'a', '
', 'l', 'a',
On 6/30/10 8:50 PM, Mladen Gogala wrote:
x=quick brown fox jumps over a lazy dog
y=''.join(list(x).reverse())
Traceback (most recent call last):
File stdin, line 1, inmodule
TypeError
Why is TypeError being thrown? The reason for throwing the type error is
the fact that the internal
Hello,
y=list(x).reverse()
print y
None
L = [a, b, c]
L.reverse()
L
[c, b, a]
As you can see, L.reverse() performs the operation on itself and returns
nothing. Hence, the return type None.
Instead of
y=''.join(list(x).reverse())
you should probably do,
t = list(x).reverse()
y =
On Wed, Jun 30, 2010 at 9:09 PM, Zubin Mithra zubin.mit...@gmail.com wrote:
Hello,
y=list(x).reverse()
print y
None
L = [a, b, c]
L.reverse()
L
[c, b, a]
As you can see, L.reverse() performs the operation on itself and returns
nothing. Hence, the return type None.
Instead of
Er, I don't think you thought that one entirely through (/ tried it out):
My Apologies.
Here is a working one.
x=123
t = list(x)
t.reverse()
print ''.join(t)
321
But of course, the method which was suggested earlier is far more elegant.
print ''.join(reversed(list(x)))
Cheers!
Zubin
On Wed, 30 Jun 2010 21:04:28 -0700, Stephen Hansen wrote:
On 6/30/10 8:50 PM, Mladen Gogala wrote:
x=quick brown fox jumps over a lazy dog
y=''.join(list(x).reverse())
Traceback (most recent call last):
File stdin, line 1, inmodule
TypeError
Why is TypeError being thrown? The reason
13 matches
Mail list logo