(This is waaay off-topic but what the heck, I'll keep going...)
On Wed, Nov 19, 2003 at 08:08:51AM -0800, Steve Lamb wrote:
| Cameron Patrick wrote:
| >Nope, no fall-through in that one, so it doesn't help. It /is/ nifty
| >though :-)
|
| Uh, there was a fall through there. Notice that if x
Cameron Patrick wrote:
Nope, no fall-through in that one, so it doesn't help. It /is/ nifty
though :-)
Uh, there was a fall through there. Notice that if x has a value that
isn't in the dictionary the if will fall through to the else.
--
Steve C. Lamb | I'm your priest, I'm
On Tue, Nov 18, 2003 at 09:58:54PM -0800, Steve Lamb wrote:
| Cameron Patrick wrote:
| >I don't think it is. Python doesn't have a switch/case equivalent. It'd
| >have to be done with a bunch of if's or something.
|
| Well, depends. Do you consider its dictionary to be a switch?
Nope, no f
Darren Salt <[EMAIL PROTECTED]> wrote:
> I find myself wondering if Duff's Device is implementable in Python...
The closest beast I can think of would generate the unrolled loop at
runtime and use 'exec' to run it. But this is a bit off topic for d-d.
--
Florent
Cameron Patrick wrote:
I don't think it is. Python doesn't have a switch/case equivalent. It'd
have to be done with a bunch of if's or something.
Well, depends. Do you consider its dictionary to be a switch?
>>> def foo():
... print "foolio"
...
>>> def bar():
... print "bario"
...
>
On Wed, Nov 19, 2003 at 01:19:32AM +, Darren Salt wrote:
| I find myself wondering if Duff's Device is implementable in Python...
I don't think it is. Python doesn't have a switch/case equivalent. It'd
have to be done with a bunch of if's or something.
Cameron.
I demand that Steve Lamb may or may not have written...
[snip]
> I hope this concludes the topic for those who haven't touched Python
> badmouthing the whitespace issue since, thus far, I've yet to see a single
> example which isn't possible in pretty much the exact same visual style.
I find myse
On Mon, Nov 17, 2003 at 08:07:35PM +, Jonathan Dowland wrote:
> Torvalds' position is that code that cannot be expressed using
> 8-spaces-per-indent and wrap at 79 characters needs to be rewritten.
Who is Thorvalds?
SCNR
Balu
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4
H. S. Teoh wrote:
Not for any non-trivial task, although I did try to learn it some time
ago. Recently, I had the chance to take another look at it; however, I
found Ruby, which seemed to have the best of both Perl and Python plus
true object-orientation. So when I move on from Perl (which I love,
On Tue, Nov 18, 2003 at 11:32:36AM -0800, Tom wrote:
> Serious #1:
>
> *It looks like multi-line method invocations require parenthesis to be
> indented at the paren level. Sometimes that's useful, but often I
> like to pack arguments tighter than that and indent only once on
> subsequent lines:
On Tue, Nov 18, 2003 at 11:04:48AM -0800, Steve Lamb wrote:
> H. S. Teoh wrote:
> >Yeah, 'whitespace' about sums up the value of it. Except to Python
> >programmers, of course. :-P :-P
>
> Quite the contrary. First off generally flames are from the
> uninformed. Since in most cases the e
Tom wrote:
On Tue, Nov 18, 2003 at 11:04:48AM -0800, Steve Lamb wrote:
*It looks like multi-line method invocations require parenthesis to be
indented at the paren level. Sometimes that's useful, but often I like
to pack arguments tighter than that and indent only once on subsequent
lines:
On Tue, Nov 18, 2003 at 11:04:48AM -0800, Steve Lamb wrote:
> H. S. Teoh wrote:
> >Yeah, 'whitespace' about sums up the value of it. Except to Python
> >programmers, of course. :-P :-P
>
> Quite the contrary. First off generally flames are from the
> uninformed. Since in most cases the e
H. S. Teoh wrote:
Yeah, 'whitespace' about sums up the value of it. Except to Python
programmers, of course. :-P :-P
Quite the contrary. First off generally flames are from the uninformed.
Since in most cases the evils of whitespace are spouted off by those who
have never once touched Pytho
I demand that Steve Lamb may or may not have written...
[snip]
> if foo
> bar
> else
> baz
fi
--
| Darren Salt | linux (or ds) at | nr. Ashington,
| woody, sarge, | youmustbejoking | Northumberland
| RISC OS | demon co uk | Toon Army
| Let's keep the pound sterling
Isaac To wrote:
E.g., it is more difficult to
cut some code in one function and paste it into another. So for best
results one really have to use an editor (and perhaps other tools) that
knows about such significant whitespaces.
Not really if one is wanting to maintain proper indention in both
On Tue, Nov 18, 2003 at 04:41:34PM +, Colin Watson wrote:
> I swore that I wasn't going to get into the latest style war, but ...
>
> On Tue, Nov 18, 2003 at 10:55:38AM -0500, H. S. Teoh wrote:
> > On Tue, Nov 18, 2003 at 11:45:52AM +0800, Cameron Patrick wrote:
> > > Personally I prefer 8-spa
On Tue, Nov 18, 2003 at 12:26:37PM -0500, Glenn Maynard wrote:
> On Tue, Nov 18, 2003 at 06:04:54PM +0100, Florent Rougon wrote:
> > If you are not able to use a programmer's editor, I fail to see how you
> > can even try to argue about the usefulness of Python's whitespace
> > handling.
>
> Yay!
On Tue, Nov 18, 2003 at 06:04:54PM +0100, Florent Rougon wrote:
> If you are not able to use a programmer's editor, I fail to see how you
> can even try to argue about the usefulness of Python's whitespace
> handling.
Yay! A whitespace flamewar!
--
Glenn Maynard
Scott James Remnant <[EMAIL PROTECTED]> wrote:
> You've never had to combine 'patch' and Python programs have you? After
> receiving a few created by people with different indent bigotries you
> quickly realise why significant whitespace is a fundamentally bad idea.
>
> I've had to go and ask som
"H. S. Teoh" <[EMAIL PROTECTED]> wrote:
> Oh, you meant autoindenting as you type... I thought you were referring to
> indenting tools. As long as it's unintrusive, I'm OK with that.
> Unintrusive as in, not anywhere near the atrociousness of MS Word, for
> example.
Um, wasn't this thread about p
Julian Mehnle wrote:
I call that readable, but I guess somebody won't. ;-)
Actually it is quite readable and sensible in that it breaks down the
regex into parts that a human can read. Oh, and the equivolant would be legal
in Python. Which was kind of my point on asking H.S. the two questio
I swore that I wasn't going to get into the latest style war, but ...
On Tue, Nov 18, 2003 at 10:55:38AM -0500, H. S. Teoh wrote:
> On Tue, Nov 18, 2003 at 11:45:52AM +0800, Cameron Patrick wrote:
> > Personally I prefer 8-space indentation, though.
>
> I find that it is too restrictive, given th
> "Scott" == Scott James Remnant <[EMAIL PROTECTED]> writes:
Scott> You've never had to combine 'patch' and Python programs have you?
Scott> After receiving a few created by people with different indent
Scott> bigotries you quickly realise why significant whitespace is a
Scott>
On Tue, Nov 18, 2003 at 11:13:46AM -0500, Glenn Maynard wrote:
> On Tue, Nov 18, 2003 at 11:00:18AM -0500, H. S. Teoh wrote:
> > > VIM can do autoindenting for some languages too. Works OK with Perl,
> > > and C, and badly with Tcl (but doesn't everything?).
> > [snip]
> >
> > Generally, I am skep
On Tue, Nov 18, 2003 at 11:00:18AM -0500, H. S. Teoh wrote:
> > VIM can do autoindenting for some languages too. Works OK with Perl,
> > and C, and badly with Tcl (but doesn't everything?).
> [snip]
>
> Generally, I am skeptical of autoindenting tools. I usually do it by hand.
> (I don't buy the w
On Tue, Nov 18, 2003 at 11:34:14PM +1100, Hamish Moffatt wrote:
> On Mon, Nov 17, 2003 at 07:57:46PM -0800, Joshua Kwan wrote:
> > Hear, hear. Yes, 8-space indentation is a matter of pressing the Tab
> > key, but it's a bit too big.. I've always stuck with two spaces.
>
> So set your tabstop (and
On Tue, Nov 18, 2003 at 11:45:52AM +0800, Cameron Patrick wrote:
> On Mon, Nov 17, 2003 at 08:56:49PM -0500, H. S. Teoh wrote:
>
> | Nevertheless, I find 8-space indentation too wasteful, 4-space
> | indentation too cumbersome to type, and 1-space indentation
> | unreadable.
>
> Your editor shoul
On Tue, 2003-11-18 at 01:46, Isaac To wrote:
> > "Tom" == Tom <[EMAIL PROTECTED]> writes:
>
> Tom> Significant whitespace? Shudder, that brings back crusty old
> Tom> memories of Fortran. I have great fondness for fortran because of
> Tom> the wonderful mathematical algorithms
On Mon, Nov 17, 2003 at 06:02:40PM -0800, Tom wrote:
> If whitespace mistakes are always caught at compile-time, then I
> probably wouldn't care about them either. So I'm not bashing python;
> having never used it: I'm bashing languages where syntatic mistakes
> are not caught at compile-time. I
On Mon, Nov 17, 2003 at 07:57:46PM -0800, Joshua Kwan wrote:
> Hear, hear. Yes, 8-space indentation is a matter of pressing the Tab
> key, but it's a bit too big.. I've always stuck with two spaces.
So set your tabstop (and shiftwidth) in vi to 4, and you'll have four
character indents. Or 2. And
On Tue, Nov 18, 2003 at 11:55:01AM +0100, Julian Mehnle wrote:
| Steve Lamb wrote:
| > 2: Can you provide an example of such free-style coding that you speak
| > so highly of?
|
| # Split header into separate header lines, dropping any unneeded or
| # spurious header lines:
| @header_lines = grep(
Steve Lamb wrote:
> 2: Can you provide an example of such free-style coding that you speak
> so highly of?
# Split header into separate header lines, dropping any unneeded or
# spurious header lines:
@header_lines = grep(
(
/^(?:
# Wanted headers:
X-Spam-Status
> "Wouter" == Wouter Verhelst <[EMAIL PROTECTED]> writes:
Tom> Significant whitespace? Shudder, that brings back crusty old
Tom> memories of Fortran. I have great fondness for fortran because of
Tom> the wonderful mathematical algorithms in LinPack, but I have no
Tom> fondnes
On Tue, Nov 18, 2003 at 04:33:16PM +0800, Cameron Patrick wrote:
> On Tue, Nov 18, 2003 at 09:10:53AM +0100, Wouter Verhelst wrote:
>
> | > Please actually try to code something in Python before commenting on its
> use
> | > of spaces. It is unlike the times of Fortran: in Fortran spaces are use
On Tue, Nov 18, 2003 at 09:10:53AM +0100, Wouter Verhelst wrote:
| > Please actually try to code something in Python before commenting on its use
| > of spaces. It is unlike the times of Fortran: in Fortran spaces are used to
| > make programs easy to read by machines; in Python spaces are used t
On Tue, Nov 18, 2003 at 09:46:15AM +0800, Isaac To wrote:
> > "Tom" == Tom <[EMAIL PROTECTED]> writes:
>
> Tom> Significant whitespace? Shudder, that brings back crusty old
> Tom> memories of Fortran. I have great fondness for fortran because of
> Tom> the wonderful mathematical
On Mon, Nov 17, 2003 at 11:08:44PM -0600, Gunnar Wolf wrote:
> H. S. Teoh dijo [Mon, Nov 17, 2003 at 08:47:27PM -0500]:
> > > >*chalks up one more reason to avoid Python like the plague...*
> > >
> > > Uh, care to rewrite that since Python is now on 2.3 and 1.5.2 is
> > > several years ol
H. S. Teoh dijo [Mon, Nov 17, 2003 at 08:47:27PM -0500]:
> > >*chalks up one more reason to avoid Python like the plague...*
> >
> > Uh, care to rewrite that since Python is now on 2.3 and 1.5.2 is
> > several years old?
> [snip]
>
> That doesn't negate the fact that I find significant w
On Mon, Nov 17, 2003 at 08:56:49PM -0500, H. S. Teoh wrote:
> Yes, that's Pure Evil(tm). Just one step away from the atrocious
> inconsistent indentation. (Believe me, I've seen *professional*
> programmers insert random amounts of space just so they satisfy the law of
> indentation, but it's compl
On Mon, Nov 17, 2003 at 08:56:49PM -0500, H. S. Teoh wrote:
> Well, that's a whole 'nother can of worms. I firmly believe that all
> functions longer than one printed page (approx 48 lines or so) are
> inherently broken and must be re-written. Nevertheless, I find 8-space
> indentation too wasteful
On Mon, Nov 17, 2003 at 08:56:49PM -0500, H. S. Teoh wrote:
| Nevertheless, I find 8-space indentation too wasteful, 4-space
| indentation too cumbersome to type, and 1-space indentation
| unreadable.
Your editor should do that for you! :-) e.g. set softtabstop=4 in vim
will allow you to have 4-
Tom wrote:
Do whitespace mistakes cause compile time errors? The frustrating thing
about fortran was variable names that started with C could be
interpreted as comments not indented correctly, which would just cause
that line to be skipped. Integer literals not indented correctly could
be int
> "Tom" == Tom <[EMAIL PROTECTED]> writes:
Tom> Do whitespace mistakes cause compile time errors? The frustrating
Tom> thing about fortran was variable names that started with C could be
Tom> interpreted as comments not indented correctly, which would just
Tom> cause that lin
On Mon, Nov 17, 2003 at 05:53:54PM -0800, Steve Lamb wrote:
> Tom wrote:
> >Significant whitespace? Shudder, that brings back crusty old memories
> >of Fortran. I have great fondness for fortran because of the wonderful
> >mathematical algorithms in LinPack, but I have no fondness for
> >signi
On Tue, Nov 18, 2003 at 09:43:40AM +0800, Isaac To wrote:
[snip]
> H> That's because the terminal settings are b0rked. I personally delete
> H> all programs that cannot cut-n-paste without messing up tabs and
> H> spaces. Unfortunately, this happens a lot on the Winbloxe desktop at
>
H. S. Teoh wrote:
That doesn't negate the fact that I find significant whitespace rather
atrocious. I really rather use a language where I'm free to format the
code the way I want it, to maximally convey its meaning, rather than to be
forced to write it a certain way because some genius decided tha
Tom wrote:
Significant whitespace? Shudder, that brings back crusty old memories
of Fortran. I have great fondness for fortran because of the wonderful
mathematical algorithms in LinPack, but I have no fondness for
significant whitespace.
And? Does Fortran's rules map to Pythons? I often
On Mon, Nov 17, 2003 at 05:14:04PM -0800, Steve Lamb wrote:
> H. S. Teoh wrote:
> >On Mon, Nov 17, 2003 at 02:29:52PM -0600, Chad Walstrom wrote:
[snip]
> >>Python did away with that requirement for scope in 2.x. If you want to
> >>use blank lines for code logic separation in python < 2.0, you mus
> "Tom" == Tom <[EMAIL PROTECTED]> writes:
Tom> Significant whitespace? Shudder, that brings back crusty old
Tom> memories of Fortran. I have great fondness for fortran because of
Tom> the wonderful mathematical algorithms in LinPack, but I have no
Tom> fondness for signific
> "H" == H S Teoh <[EMAIL PROTECTED]> writes:
H> I have a hate-hate relationship with it. I much prefer free-style
H> syntax where the programmer is allowed to use his best judgment on
H> how to indent the code. Of course, in less-than-ideal projects, or
H> projects with less-t
On Tue, Nov 18, 2003 at 09:28:29AM +0800, Isaac To wrote:
> > "H" == H S Teoh <[EMAIL PROTECTED]> writes:
>
> H> That would mean 95% of non-trivial XSLT stylesheets would need to be
> H> rewritten...
>
> Or perhaps the XSLT language itself needs to be rewritten.
[snip]
Yes, that was
On Mon, Nov 17, 2003 at 05:21:23PM -0800, Steve Lamb wrote:
> H. S. Teoh wrote:
> >On Mon, Nov 17, 2003 at 11:47:34AM -0600, Chad Walstrom wrote:
> >[snip]
>
> >>I have a love-hate relationship with the significant whitespace.
>
> >I have a hate-hate relationship with it. I much prefer free-style
> "H" == H S Teoh <[EMAIL PROTECTED]> writes:
H> That would mean 95% of non-trivial XSLT stylesheets would need to be
H> rewritten...
Or perhaps the XSLT language itself needs to be rewritten.
Regards,
Isaac.
H. S. Teoh wrote:
On Mon, Nov 17, 2003 at 11:47:34AM -0600, Chad Walstrom wrote:
[snip]
I have a love-hate relationship with the significant whitespace.
I have a hate-hate relationship with it. I much prefer free-style syntax
where the programmer is allowed to use his best judgment on how to inde
H. S. Teoh wrote:
On Mon, Nov 17, 2003 at 02:29:52PM -0600, Chad Walstrom wrote:
On Mon, Nov 17, 2003 at 02:19:02PM -0500, H. S. Teoh wrote:
Also, as an off-topic note, blank lines that contain tabs or spaces
are Pure Evil(tm), especially in code. One of these days I should
write a sed script to
On Mon, Nov 17, 2003 at 02:29:52PM -0600, Chad Walstrom wrote:
> On Mon, Nov 17, 2003 at 02:19:02PM -0500, H. S. Teoh wrote:
> > Also, as an off-topic note, blank lines that contain tabs or spaces
> > are Pure Evil(tm), especially in code. One of these days I should
> > write a sed script to elimin
On Mon, Nov 17, 2003 at 08:07:35PM +, Jonathan Dowland wrote:
> On Mon, Nov 17, 2003 at 02:19:02PM -0500, H. S. Teoh wrote:
>
> > For personal pet projects, I use 2 spaces per nesting level. Some people
> > think that's Pure Evil(tm),
>
> Most noteably perhaps, Linus Torvalds, although...
>
On Mon, Nov 17, 2003 at 02:19:02PM -0500, H. S. Teoh wrote:
> Also, as an off-topic note, blank lines that contain tabs or spaces
> are Pure Evil(tm), especially in code. One of these days I should
> write a sed script to eliminate all incarnations of this Pure Evil(tm)
> from /usr/src.
Python did
On Mon, Nov 17, 2003 at 02:19:02PM -0500, H. S. Teoh wrote:
> For personal pet projects, I use 2 spaces per nesting level. Some people
> think that's Pure Evil(tm),
Most noteably perhaps, Linus Torvalds, although...
>although I fully agree with you about wasting
> screen real estate in 80 colu
other problem. Try cut-n-paste in X between code that uses tabs[2].
> Sometimes the tabs are not preserved. Very odd and annoying.
That's because the terminal settings are b0rked. I personally delete all
programs that cannot cut-n-paste without messing up tabs and spaces.
Unfortunately, this hap
27;s simple to implement
scope via significant whitespace.
So, tabs v.s. spaces isn't really a concern except when mixing the two.
If you use eight spaces for all indentation, it won't matter. If you
use some other number, it's best to use spaces exclusively. If you use
62 matches
Mail list logo