Prasad, Ramit wrote:
I have to say, I do like Python's lack of keywords for these things
I thought True/False were among the list of keywords in Python 3.x ? Or are
those the only keywords?
http://docs.python.org/py3k/reference/lexical_analysis.html#keywords
False class finally
>I have to say, I do like Python's lack of keywords for these things
I thought True/False were among the list of keywords in Python 3.x ? Or are
those the only keywords?
Ramit
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone
On 27/05/2011 07:34, Tim Roberts wrote:
MRAB wrote:
I'd just like to point out that it's a convention, not a rigid rule.
Reminds me of the catch-phrase from the first Pirates of the Caribbean
movie: "It's more of a guideline than a rule."
Much like the Zen of Python.
--
http://mail.python.
MRAB wrote:
>
>I'd just like to point out that it's a convention, not a rigid rule.
Reminds me of the catch-phrase from the first Pirates of the Caribbean
movie: "It's more of a guideline than a rule."
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailm
On Fri, May 27, 2011 at 1:52 PM, Steven D'Aprano
wrote:
> Because "lst" is not a real word. To native readers of languages derived
> from Latin or Germany, such as English, it is quite a strange "word"
> because it has no vowel. In addition, it looks like 1st (first).
Contrived examples are alway
On Fri, 27 May 2011 13:24:24 +1000, Chris Angelico wrote:
> On Fri, May 27, 2011 at 11:59 AM, Steven D'Aprano
> wrote:
>> def get(list, object):
>> """Append object to a copy of list and return it.""" return list +
>> [object]
>>
>> For one or two line functions, I think that's perfectly re
On Fri, May 27, 2011 at 11:59 AM, Steven D'Aprano
wrote:
> def get(list, object):
> """Append object to a copy of list and return it."""
> return list + [object]
>
> For one or two line functions, I think that's perfectly reasonable.
> Anything more than that, I'd be getting nervous.
But ev
On Thu, 26 May 2011 11:27:35 -0700, John Ladasky wrote:
> On May 25, 9:46 pm, Uncle Ben wrote:
>
>> list = [1,2,3]
>
> Somewhat unrelated, but... is it a good idea to name your list "list"?
> Isn't that the name of Python's built-in list constructor method?
>
> Shadowing a built-in has contri
On 5/26/2011 11:58 AM, MRAB wrote:
On 26/05/2011 06:17, Chris Rebert wrote:
list.remove(), list.sort(), and list.extend() similarly return None
rather than the now-modified list.
I'd just like to point out that it's a convention, not a rigid rule.
Sometimes it's not followed, for example, dic
>> And why do you insist on calling an instance of list, "list"? Even a
>> human reader will confuse which is which. What you are showing is an
>> example how confusing things become when a keyword (list) is
>> over-written (with list instance).
> (Minor note: 'list' is not a keyword (if it were,
On 5/26/2011 3:18 AM, Algis Kabaila wrote:
And why do you insist on calling an instance of list, "list"? Even a
human reader will confuse which is which. What you are showing is an
example how confusing things become when a keyword (list) is
over-written (with list instance).
(Minor note: 'lis
On May 25, 9:46 pm, Uncle Ben wrote:
> list = [1,2,3]
Somewhat unrelated, but... is it a good idea to name your list
"list"? Isn't that the name of Python's built-in list constructor
method?
Shadowing a built-in has contributed to more than one subtle bug in my
code, and I've learned to avoid
On Fri, May 27, 2011 at 1:58 AM, MRAB wrote:
> I'd just like to point out that it's a convention, not a rigid rule.
> Sometimes it's not followed, for example, dict.setdefault.
dict.setdefault is more like dict.get but it also stores the result.
It's probably more a name issue than a protocol iss
On 26/05/2011 06:17, Chris Rebert wrote:
On Wed, May 25, 2011 at 9:46 PM, Uncle Ben wrote:
In playing with lists of lists, I found the following:
(In 3.1, but the same happens also in 2.7)
list = [1,2,3]
list.append ( [4,5,6] )
Note the lack of output after this line. This indicates that
li
On Thu, May 26, 2011 at 12:23 AM, Chris Angelico wrote:
> On Thu, May 26, 2011 at 5:20 PM, Chris Angelico wrote:
>>
>> Ben Finney has already answered the main question
>
> Giving credit where credit's due, it was more Chris Rebert's post that
> answered the question. Sorry Chris!
Eh, one can't
On May 26, 12:46 am, Uncle Ben wrote:
> In playing with lists of lists, I found the following:
>
> (In 3.1, but the same happens also in 2.7)
>
> list = [1,2,3]
> list.append ( [4,5,6] )
> x = list
> x ->
> [1,2,3,[4,5,6]]
> as expected.
>
> But the shortcut fails:
>
> list=[1,2,3]
> x = lis
On Thu, May 26, 2011 at 5:20 PM, Chris Angelico wrote:
>
> Ben Finney has already answered the main question
Giving credit where credit's due, it was more Chris Rebert's post that
answered the question. Sorry Chris!
Chris Angelico
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, May 26, 2011 at 2:46 PM, Uncle Ben wrote:
> In playing with lists of lists, I found the following:
>
> (In 3.1, but the same happens also in 2.7)
>
> list = [1,2,3]
Ben Finney has already answered the main question, but as a side
point, I would generally avoid creating a variable called '
On Thursday 26 May 2011 14:46:45 Uncle Ben wrote:
> In playing with lists of lists, I found the following:
>
> (In 3.1, but the same happens also in 2.7)
>
> list = [1,2,3]
> list.append ( [4,5,6] )
> x = list
> x ->
> [1,2,3,[4,5,6]]
> as expected.
>
> But the shortcut fails:
>
> list=[1
On Wed, May 25, 2011 at 9:46 PM, Uncle Ben wrote:
> In playing with lists of lists, I found the following:
>
> (In 3.1, but the same happens also in 2.7)
>
> list = [1,2,3]
> list.append ( [4,5,6] )
Note the lack of output after this line. This indicates that
list.append([4,5,6]) returned None. C
Uncle Ben writes:
> Can someone explain this to me?
Yes, the documentation for that function (‘list.append’) can explain it.
In short: if a method modifies the instance, that method does not return
the instance. This policy holds for the built-in types, and should be
followed for user-defined t
In playing with lists of lists, I found the following:
(In 3.1, but the same happens also in 2.7)
list = [1,2,3]
list.append ( [4,5,6] )
x = list
x ->
[1,2,3,[4,5,6]]
as expected.
But the shortcut fails:
list=[1,2,3]
x = list.append( [4,5,6] )
x ->
nothing
Can someone explain this t
22 matches
Mail list logo