On Tuesday, September 9, 2014 11:25:29 AM UTC+5:30, JBB wrote:
> I have a list with a fixed number of elements which I need to grow; ie. add
> rows of a fixed number of elements, some of which will be blank.
> e.g. [['a','b','c','d'], ['A','B','C','D'], ['', 'aa', 'inky', ''], ['',
> 'bb', 'bink
Peter Otten <__peter__ web.de> writes:
[Deletia]
To Peter Otten and Paul Kroeger:
Thank you both, very much. I think I now get why the binding works as it
does in addition to why the list() approach worked.
(Third attempt - priors not going through, please excuse any repetition)
JBB
--
h
Paul Kroeger prz-wugen.com> writes:
>
> Hello,
>
> I'm myself still learning Python, so others may please correct me, if
> I'm wrong.
...
> I hope, the above helps to understand why this behaviour.is to be
> expected.
>
To Peter Otten and Paul Kroeger:
Thank you both, very much. I think I no
Hello,
I'm myself still learning Python, so others may please correct me, if
I'm wrong.
Consider the following sentence of your link "jeffknupp.com/...":
"some_guy and first_names[0] both refer to the same object"
This is what is going on here.
Am Dienstag, den 09.09.2014, 05:50 + schrieb
JBB wrote:
> I have a list with a fixed number of elements which I need to grow; ie.
> add rows of a fixed number of elements, some of which will be blank.
>
> e.g. [['a','b','c','d'], ['A','B','C','D'], ['', 'aa', 'inky', ''], ['',
> 'bb', 'binky', ''], ... ]
>
> This is a reduced representatio
Frank Millman chagford.com> writes:
>
>
> "JBB" gmail.com> wrote in message
> news:loom.20140909T073428-713 post.gmane.org...
> >I have a list with a fixed number of elements which I need to grow; ie. add
> > rows of a fixed number of elements, some of which will be blank.
...
> I am sure th
"JBB" wrote in message
news:loom.20140909t073428-...@post.gmane.org...
>I have a list with a fixed number of elements which I need to grow; ie. add
> rows of a fixed number of elements, some of which will be blank.
>
> e.g. [['a','b','c','d'], ['A','B','C','D'], ['', 'aa', 'inky', ''], ['',
> 'b
I have a list with a fixed number of elements which I need to grow; ie. add
rows of a fixed number of elements, some of which will be blank.
e.g. [['a','b','c','d'], ['A','B','C','D'], ['', 'aa', 'inky', ''], ['',
'bb', 'binky', ''], ... ]
This is a reduced representation of a larger list-of-li
On Wed, May 23, 2012 at 12:42 PM, Dave Angel wrote:
> On 05/23/2012 03:13 PM, Emile van Sebille wrote:
>> A design decision -- there's currently a mix of methods that return
>> themselves and not. Mostly is appears to me that mutables modify in
>> place without returning self and immutables retur
On 05/23/2012 03:13 PM, Emile van Sebille wrote:
> On 5/23/2012 5:23 AM 水静流深 said...
>> >>> s=[1,2,3]
>> >>> s.append(5)
>> >>> s
>> [1, 2, 3, 5]
>> >>> s=s.append(5)
>> >>> s
>> >>> print s
>> None
>>
>> why can't s=s.append(5)
>
> It could, but it doesn't.
>
>
>> ,what is the reason?
>
>
>
On 5/23/2012 5:23 AM 水静流深 said...
>>> s=[1,2,3]
>>> s.append(5)
>>> s
[1, 2, 3, 5]
>>> s=s.append(5)
>>> s
>>> print s
None
why can't s=s.append(5)
It could, but it doesn't.
,what is the reason?
A design decision -- there's currently a mix of methods that return
themselves and not
On Wed, May 23, 2012 at 8:23 AM, 水静流深 <1248283...@qq.com> wrote:
s=[1,2,3]
s.append(5)
s
> [1, 2, 3, 5]
s=s.append(5)
s
print s
> None
>
> why can't s=s.append(5) ,what is the reason?
For the same reason that you don't see `[1, 2, 3, 5]` immediately
after doing `s.a
wrote:
>>> s=[1,2,3]
>>> s.append(5)
>>> s
[1, 2, 3, 5]
>>> s=s.append(5)
>>> s
>>> print s
None
why can't s=s.append(5) ,what is the reason?
Because the append method returns None, not the object. It modifies the
object in
>>> s=[1,2,3]
>>> s.append(5)
>>> s
[1, 2, 3, 5]
>>> s=s.append(5)
>>> s
>>> print s
None
why can't s=s.append(5) ,what is the reason?--
http://mail.python.org/mailman/listinfo/python-list
On 7/13/2010 4:22 AM, Gregory Ewing wrote:
John Nagle wrote:
Arguably, if a function just does a "return",
it should be an error to try to use its return value.
It's been suggested at least once before that the
default return value for a function should be some
special value that raises an exc
The better question is, do I ever use them? Thinking back over the code I've
written in the last couple of years, I would say probably two or three times
(mostly in unit tests). I've had to code around string's sequence behavior
DOZENS of times. Is it nifty that strings can be sliced like that?
[Original not available on my swerver, responding here]
>On 7/11/10 10:03 PM, Nathan Rice wrote:
>>
>> Yeah, I long ago filed the in place place in the same folder as
>> strings-as-sequences, all() returning True for an empty iterable and any
>> returning True rather than the thing which triggered
John Nagle wrote:
Arguably, if a function just does a "return",
it should be an error to try to use its return value.
It's been suggested at least once before that the
default return value for a function should be some
special value that raises an exception if you try
to do anything with it exc
On 7/11/2010 5:24 PM, Steven D'Aprano wrote:
On Sun, 11 Jul 2010 08:59:06 -0700, dhruvbird wrote:
Why doesn't python's list append() method return the list itself? For
that matter, even the reverse() and sort() methods? I found this link
(http://code.google.com/edu/language
On Jul 12, 4:20 pm, Hrvoje Niksic wrote:
> dhruvbird writes:
> > No, I meant x.append(4)
> > Except that I want to accomplish it using slices.
>
> > (I can do it as x[lex(x):] = [item_to_append] but is there any other
> > way?)
>
> It seems that you've found a way to do so, so why do you need ano
Stephen:
I'm not adverse to being able to do that, but the number of times that I've
wanted to do that is greatly outweighed by the number of times I've had to
pass a function "(somestring,)" or call "if isinstance(foo, basestring):
..." to avoid producing a bug. The more abstract and adaptive th
dhruvbird writes:
> No, I meant x.append(4)
> Except that I want to accomplish it using slices.
>
> (I can do it as x[lex(x):] = [item_to_append] but is there any other
> way?)
It seems that you've found a way to do so, so why do you need another
way? Are you after elegance? Efficiency? Brevi
On Jul 12, 5:30 am, News123 wrote:
> dhruvbird wrote:
>
> > On a side note, is there any other way to append to a list using
> > slices (apart from the one below):
> > x[len(x):len(x)] = [item to append]
>
> dy you mean
> x.extend([1,2,3])
No, I meant x.append(4)
Except that I want to accomplish
On Sun, Jul 11, 2010 at 10:03 PM, Nathan Rice
wrote:
> Yeah, I long ago filed the in place place in the same folder as
> all() returning True for an empty iterable
If you weren't taught about vacuous truth (or even identity elements)
in Discrete Mathematics, someone fscked up. Said behavior is t
On 7/11/10 10:03 PM, Nathan Rice wrote:
> Yeah, I long ago filed the in place place in the same folder as
> strings-as-sequences, all() returning True for an empty iterable and any
> returning True rather than the thing which triggered it.
You know, the latter two I can see an argument for, and co
Yeah, I long ago filed the in place place in the same folder as
strings-as-sequences, all() returning True for an empty iterable and any
returning True rather than the thing which triggered it. Almost always
annoying and worked around, but that's the price you pay for the other nice
stuff :) It j
On Jul 11, 8:59 am, dhruvbird wrote:
> Why doesn't python's list append() method return the list itself? For
> that matter, even the reverse() and sort() methods?
Because Guido thinks that having those methods return None is the best
way to communicate that the underlying object
dhruvbird wrote:
>
> On a side note, is there any other way to append to a list using
> slices (apart from the one below):
> x[len(x):len(x)] = [item to append]
dy you mean
x.extend([1,2,3])
?
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 11 Jul 2010 08:59:06 -0700, dhruvbird wrote:
> Why doesn't python's list append() method return the list itself? For
> that matter, even the reverse() and sort() methods? I found this link
> (http://code.google.com/edu/languages/google-python- class/lists.html)
> wh
On Jul 11, 9:19 pm, Thomas Jollans wrote:
> On 07/11/2010 05:59 PM, dhruvbird wrote:
>
> > Why doesn't python's list append() method return the list itself? For
> > that matter, even the reverse() and sort() methods?
> > I found this link (http://code.goog
Thomas Jollans wrote:
On 07/11/2010 05:59 PM, dhruvbird wrote:
Why doesn't python's list append() method return the list itself? For
that matter, even the reverse() and sort() methods?
I found this link (http://code.google.com/edu/languages/google-python-
class/lists.html) which sug
On Sun, 11 Jul 2010 08:59:06 -0700 (PDT)
dhruvbird wrote:
> Why doesn't python's list append() method return the list itself? For
> that matter, even the reverse() and sort() methods?
> I found this link (http://code.google.com/edu/languages/google-python-
> class/lists.htm
On 07/11/2010 06:28 PM, Nathan Rice wrote:
> Do list(reversed(list(reversed([1, 2, 3, 4])) + [[]]))
>
> Though TBH sometimes get annoyed at this behavior myself. There are a
> lot of people who are very vocal in support of returning none, and it
> makes sense in some ways. Since reversed returns
Do list(reversed(list(reversed([1, 2, 3, 4])) + [[]]))
Though TBH sometimes get annoyed at this behavior myself. There are a lot
of people who are very vocal in support of returning none, and it makes
sense in some ways. Since reversed returns an iterator though, it makes
this code horrible and
On 07/11/2010 05:59 PM, dhruvbird wrote:
> Why doesn't python's list append() method return the list itself? For
> that matter, even the reverse() and sort() methods?
> I found this link (http://code.google.com/edu/languages/google-python-
> class/lists.html) which suggest
Why doesn't python's list append() method return the list itself? For
that matter, even the reverse() and sort() methods?
I found this link (http://code.google.com/edu/languages/google-python-
class/lists.html) which suggests that this is done to make sure that
the programmer understand
36 matches
Mail list logo