On Sat, 16 Feb 2008 11:14:10 -0500, Steve Holden wrote:
> It's about four years since I wrote a program that ran for more than 24
> hours.
Let me guess... and then you discovered ''.join(['x', 'y']) instead of
'x'+'y'?
*wink*
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
Boris Borcic wrote:
> Steve Holden wrote:
[...]
>> Before you have any code is exactly the *wrong* time to be considering
>> performance.
>
> Yeah right, [] and {} are premature optimizations, one should always use
> list()
> or dict() unless one detains figures to justify the more exotic forms
Steve Holden wrote:
> Boris Borcic wrote:
>> [EMAIL PROTECTED] wrote:
>>> ...Missing that, I think dict() and set() and
>>> tuple() and list() look better than using {} for the empty dict and
>>> {/} for the empty set and () for empty tuple (or {} for the empty dict
>>> and set() for the empty set)
On Sat, 16 Feb 2008 05:21:22 -0500, Steve Holden wrote:
> Before you have any code is exactly the *wrong* time to be considering
> performance.
Well, not really.
Don't we already tell people "don't use repeated string concatenation,
because it is slow", even *before* we know whether it is a bot
Boris Borcic wrote:
> [EMAIL PROTECTED] wrote:
>> ...Missing that, I think dict() and set() and
>> tuple() and list() look better than using {} for the empty dict and
>> {/} for the empty set and () for empty tuple (or {} for the empty dict
>> and set() for the empty set).
>
> The problem I have w
[EMAIL PROTECTED] wrote:
>
> ...Missing that, I think dict() and set() and
> tuple() and list() look better than using {} for the empty dict and
> {/} for the empty set and () for empty tuple (or {} for the empty dict
> and set() for the empty set).
The problem I have with them is in no way the l
[EMAIL PROTECTED] wrote:
> The irony that, x = (,) produces an error.
>
> Personally I would of thought it would be a better example of an empty
> tuple than anything else, but it still isn't that readable.
>
> The use of dict/list/tuple/set seems to stand out a lot better, makes
> it readable! E
Nick Craig-Wood <[EMAIL PROTECTED]> writes:
> Ben Finney <[EMAIL PROTECTED]> wrote:
> > [EMAIL PROTECTED] writes:
> >
> > > Missing that, I think dict() and set() and tuple() and list()
> >
> > I often use these myself. They're slightly more explicit, which can
> > help when I want the reader
Ben Finney <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] writes:
>
> > Missing that, I think dict() and set() and tuple() and list()
>
> I often use these myself. They're slightly more explicit, which can
> help when I want the reader not to have to think too much, and they're
> not particul
The irony that, x = (,) produces an error.
Personally I would of thought it would be a better example of an empty
tuple than anything else, but it still isn't that readable.
The use of dict/list/tuple/set seems to stand out a lot better, makes
it readable! Else in a few years you'll have §x§ = !^
On Feb 12, 9:30 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> George Sakkis <[EMAIL PROTECTED]> writes:
> > On Feb 12, 7:02 pm, Ben Finney <[EMAIL PROTECTED]>
> > wrote:
> > > That makes it even more a violation of
> > > principle-of-least-astonishment that the '(foo)' form doesn't give
> > > a one-e
George Sakkis <[EMAIL PROTECTED]> writes:
> On Feb 12, 7:02 pm, Ben Finney <[EMAIL PROTECTED]>
> wrote:
> > That makes it even more a violation of
> > principle-of-least-astonishment that the '(foo)' form doesn't give
> > a one-element tuple literal.
>
> The reason being, of course, that in this
On Feb 12, 7:02 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> Steve Holden <[EMAIL PROTECTED]> writes:
> > Ben Finney wrote:
> > [...]
>
> > > Note that '()' is syntactically null. Parentheses don't declare a
> > > tuple literal, commas do. Parentheses are for grouping within
> > > expressions, not s
[EMAIL PROTECTED] writes:
> Ben Finney:
> > Generator literals do not require the parens at all. However, the
> > syntax of where the generator literal *appears* can make it
> > necessary to explicitly group the expression using parens.
>
> Have you taken a look at Boo?
> In Python this isn't pos
Ben Finney:
> Generator literals do not require the
> parens at all. However, the syntax of where the generator literal
> *appears* can make it necessary to explicitly group the expression
> using parens.
Have you taken a look at Boo?
In Python this isn't possible:
s = char for char in string.digi
[EMAIL PROTECTED] writes:
> In Python ( ) denote:
> - expression grouping
> - they are very often used to denote tuples (despite being necessary
> only for the empty one)
> - generators (x for x in ...).
> The Boo language shows that () aren't that necessary for the
> generators.
Now, that one I
Steve Holden <[EMAIL PROTECTED]> writes:
> Ben Finney wrote:
> [...]
> >
> > Note that '()' is syntactically null. Parentheses don't declare a
> > tuple literal, commas do. Parentheses are for grouping within
> > expressions, not specifying type.
> >
> Tell that to the interpreter:
>
> >>> type((
Ben Finney wrote:
[...]
>
> Note that '()' is syntactically null. Parentheses don't declare a
> tuple literal, commas do. Parentheses are for grouping within
> expressions, not specifying type.
>
Tell that to the interpreter:
>>> type(())
>>> tuple() is ()
True
>>>
regards
Steve
--
Steve
Ben Finney:
> I often use these myself. They're slightly more explicit, which can
> help when I want the reader not to have to think too much, and they're
> not particularly verbose because the names are well-chosen and short.
I'd like "list" be called "array" ;-)
> Note that '()' is syntactical
[EMAIL PROTECTED] writes:
> For Python 3.0 I'd like {} for the empty set and {:} for the empty
> dict, but that idea was refused time ago, probably for some mental
> backward compatibility.
I agree with not breaking that backward compatibility; it seems
wanton.
> Missing that, I think dict() and
Paul Rubin:
> In 3.0 you may be able to say {,} but there is a contingent that would
> just as soon get rid of all that special syntax, so you'd say list()
> instead of [], dict() instead of {}, etc.
For Python 3.0 I'd like {} for the empty set and {:} for the empty
dict, but that idea was refused
"Sun" <[EMAIL PROTECTED]> writes:
> I was wondering why can't I use a format as "var = {} " to
> "var=list()" in set variable, and decided not to bother with it.
Python 3.0 will gain syntax to specify a literal of type 'set'
http://www.python.org/dev/peps/pep-3100/>::
>>> {17, "foo", 12.5}
"Sun" <[EMAIL PROTECTED]> writes:
> I was wondering why can't I use a format as "var = {} " to "var=list()" in
> set variable, and decided not to bother with it.
In 3.0 you may be able to say {,} but there is a contingent that would
just as soon get rid of all that special syntax, so you'd say l
En Tue, 12 Feb 2008 12:04:43 -0200, Sun <[EMAIL PROTECTED]> escribió:
> "Chris" <[EMAIL PROTECTED]> wrote
> test = set()
> test
>> set([])
>
> yeah, that 's what I am looking for, thanks all for such prompt answers!
>
> I was wondering why can't I use a format as "var = {} " to "var=list()
"Chris" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Feb 12, 3:45 pm, "Sun" <[EMAIL PROTECTED]> wrote:
>> Maybe this is a very primative question, but I just get a bit confused
>> about
>> 'set' and 'Set' module in python.
>>
>> I understand 'set' is a build in type in python
On Feb 12, 3:45 pm, "Sun" <[EMAIL PROTECTED]> wrote:
> Maybe this is a very primative question, but I just get a bit confused about
> 'set' and 'Set' module in python.
>
> I understand 'set' is a build in type in python after 2.4(or 2.3) and Set a
> seperate module, anyhow, I gonna use build in 'se
On Tue, 12 Feb 2008 14:45:43 +0100, Sun wrote:
> then the question is how can I declare a empty set variable as a 'var= []'
> do to a list variable?
You don't declare variables in Python. Just create an instance of `set`
and bind it to a name:
var = set()
Ciao,
Marc 'BlackJack' Rintsc
Maybe this is a very primative question, but I just get a bit confused about
'set' and 'Set' module in python.
I understand 'set' is a build in type in python after 2.4(or 2.3) and Set a
seperate module, anyhow, I gonna use build in 'set'.
then the question is how can I declare a empty set vari
28 matches
Mail list logo