Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, RG wrote: > In article , > Seebs wrote: >> And that's the magic of static typing: It is not a false positive to >> warn you that "2L" is not of type int. > We'll have to agree to disagree about that. No, we won't. It's t

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, RG wrote: > My code compiles with no warnings under gcc -Wall. That's nice. gcc -Wall uses only a small subset of warnings that fit the usual expectations of C code that's trying to work on common architectures. >> 2. The constant is not of type int, and the compiler will warn y

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, Lie Ryan wrote: > On 09/30/10 16:09, TheFlyingDutchman wrote: >> Dynamic typed languages like Python fail in this case on "Never blows >> up". > How do you define "Never blows up"? I would say "blow up" would be "raise an exception". > Personally, I'd consider maximum(8589934592,

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, Pascal Bourguignon wrote: > Nick Keighley writes: >> do you have any evidence that this is actually so? That people who >> program in statically typed languages actually are prone to this "well >> it compiles so it must be right" attitude? > Yes, I can witness that it's in the min

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, RG wrote: > You can't have it both ways. Either I am calling it incorrectly, in > which case I should get a compiler error, You get a warning if you ask for it. If you choose to run without all the type checking on, that's your problem. -s -- Copyright 2010, all wrongs reverse

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, Paul Rubin wrote: > int maximum(int a, int b); > > int foo() { > int (*barf)() = maximum; > return barf(3); > } > This compiles fine for me. Where is the cast? On the first line of code inside foo(). > Where is the error message? You chose to use a form

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, RG wrote: > We lost some important context somewhere along the line: >> > > in C I can have a function maximum(int a, int b) that will always >> > > work. Never blow up, and never give an invalid answer. If someone >> > > tries to call it incorrectly it is a compile error. > Pleas

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, TheFlyingDutchman wrote: > even with the option -Wall (all warnings). For various historical reasons, "-Wall" has the semantics you might expect from an option named "-Wsome-common-warnings-but-not-others". -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nos...

Re: "Strong typing vs. strong testing"

2010-09-29 Thread Seebs
On 2010-09-30, RG wrote: > Of course. Computers always do only exactly what you ask of them. On > this view there is, by definition, no such thing as a bug, only > specifications that don't correspond to one's intentions. f00f. That said... I think you're missing Keith's point. > Unfortun

Re: Clarification of notation

2010-09-29 Thread Seebs
On 2010-09-30, Bruce Whealton wrote: > Next, from the documentation I see and this is just an example (this > kind of notation is seen elsewhere in the documentation: > str.count(sub[, start[, end]]) > This particular example is from the string methods. > Is this a nesting of two lists inside a

Re: (and scheme lisp) x Python and modern langs [was Re: gossip, Guy Steel, Lojban, Racket]

2010-09-29 Thread Seebs
On 2010-09-30, namekuseijin wrote: > it generates a list from syntax comprehended in list-like syntax! Okay, help me out here. (Killed the crossposting.) I am not understanding how the word applies. I'm fine with it, but I don't see any relation at all between the thing called a list comprehen

Re: "Strong typing vs. strong testing"

2010-09-29 Thread Seebs
On 2010-09-30, RG wrote: > That the problem is "elsewhere in the program" ought to be small > comfort. It is, perhaps, but it's also an important technical point: You CAN write correct code for such a thing. > int maximum(int a, int b) { return a > b ? a : b; } > int main() { > long x = 858

Re: System idle time under Linux

2010-09-29 Thread Seebs
On 2010-09-29, Hugo L?veill? wrote: > One I am looking for, is time since last user mouse or keyboard action. > So I guess I am looking for the exact same thing a screensaver is > looking for You can probably get it from X somehow, but... Basically, be aware that it is entirely possible for a Lin

Re: System idle time under Linux

2010-09-29 Thread Seebs
On 2010-09-29, Hugo L?veill? wrote: > I have found it for windows and mac, but no luck under linux. Any idea? I don't think it's semantically well-defined. What makes a system "idle"? Is the machine in my basement idle? I don't think anyone's touched the keyboard in a week, but it's spent a bi

Re: sequence multiplied by -1

2010-09-29 Thread Seebs
On 2010-09-29, Lawrence D'Oliveiro wrote: > In message , Seebs wrote: >> Helps, perhaps, that I got exposed to group theory early enough to be used >> to redefining + and * to be any two operations which have interesting >> properties ... > But groups only have one

Re: if the else short form

2010-09-29 Thread Seebs
On 2010-09-29, Tracubik wrote: > Hi all, > I'm studying PyGTK tutorial and i've found this strange form: > > button = gtk.Button(("False,", "True,")[fill==True]) > > the label of button is True if fill==True, is False otherwise. > > i have googled for this form but i haven't found nothing, so can

Re: Example or recomendation of a webserver

2010-09-28 Thread Seebs
On 2010-09-29, Hidura wrote: > I am working on a web project written on Py3k and using mod_wsgi on > the Apache that have to recibes the request client via a xml structure > and i am facing a lot of troubles with the upload files mainly because > i can' t see where they are, so i' ve decide to wri

Re: partial sums problem

2010-09-28 Thread Seebs
On 2010-09-28, Gary Herron wrote: > Python does have "s+=t" as a statement, and it does have list > comprehensions [... for ...] as expressions, but you cannot put a > statement inside an expression. I've inferred that, in Python, all assignments are by definition statements, rather than expre

Re: function decorators

2010-09-28 Thread Seebs
On 2010-09-28, Nick Donohue wrote: > why would I use these? wouldn't it be more flexible to not write the > decorator before the function definition, so I could choose to wrap it > or not? The utility is that it lets you modify all calls to a function at once, without changing all the instances i

Re: toy list processing problem: collect similar terms

2010-09-27 Thread Seebs
On 2010-09-28, John Bokma wrote: > Seebs writes: >> On 2010-09-26, J?rgen Exner wrote: >>> It was livibetter who without any motivation or reasoning posted Python >>> code in CLPM. >> Not exactly; he posted it in a crossposted thread, which happened to

Re: toy list processing problem: collect similar terms

2010-09-27 Thread Seebs
On 2010-09-26, J?rgen Exner wrote: > It was livibetter who without any motivation or reasoning posted Python > code in CLPM. Not exactly; he posted it in a crossposted thread, which happened to include CLPM and other groups, including comp.lang.python. It is quite possible that he didn't know ab

Re: toy list processing problem: collect similar terms

2010-09-27 Thread Seebs
On 2010-09-26, Xah Lee wrote: > On Sep 25, 11:17??pm, Paul Rubin wrote: >> Python solution follows (earlier one with an error cancelled). ??All >> crossposting removed since crossposting is a standard trolling tactic. > btw, i disagree about your remark on crossposting. You're wrong. Crosspost

Re: sequence multiplied by -1

2010-09-26 Thread Seebs
On 2010-09-26, Steven D'Aprano wrote: > On Sat, 25 Sep 2010 23:46:57 -0700, Paul Rubin wrote: >> I think the idea is you should not be able to do mathematical operations >> on strings, and if you try to do one, Python should raise an exception, >> rather than using hokey analogies to guess at what

Re: Too much code - slicing

2010-09-23 Thread Seebs
On 2010-09-23, Andreas Waldenburger wrote: > On 23 Sep 2010 03:54:52 GMT Seebs wrote: >> I don't generally like constructs where important structural >> information comes late in the construct. [snip] > I think that is precisely the reason that the elements of the lis

Re: Check whether file is being written to

2010-09-23 Thread Seebs
On 2010-09-23, loial wrote: > How can I check whether a file is being written to by another process > before I access it? You mean "written to" or "open for possible writing"? It may be possible (with sufficient privileges) to determine that a file has been opened for writing. I don't think you

Re: Too much code - slicing

2010-09-22 Thread Seebs
On 2010-09-23, John Bokma wrote: > Seebs writes: >> I dunno. I like the "next if /^$/" idiom, > I don't (as a Perl programmer), I prefer: Huh, those are actually nicer. I didn't know that was possible; it wouldn't have occurred to me to try to put &q

Re: Too much code - slicing

2010-09-22 Thread Seebs
On 2010-09-23, Steven D'Aprano wrote: > On Thu, 23 Sep 2010 01:49:44 +0000, Seebs wrote: >> But I do think it's unfair to dismiss it as purely a matter of baby duck >> syndrome. Consistency in ordering of corresponding idioms seems a >> reasonable goal. >

Re: Too much code - slicing

2010-09-22 Thread Seebs
On 2010-09-23, Steven D'Aprano wrote: > Yes, it certainly is. Describing it as "an ugly format" is also a matter > of taste -- taste which in my opinion simply isn't justified by anything > other than familiarity. It may not be convincing to other people, but the logical inversion strikes me as

Re: Down with tinyurl! (was Re: importing excel data into a pythonmatrix?)

2010-09-20 Thread Seebs
On 2010-09-21, Steven D'Aprano wrote: > Yes, I know that. I sympathized with your experience and explicitly said > I was talking about "generic you". Hah! Then it was *I* who wasn't reading carefully enough! I bet you didn't expect *THAT*! -s -- Copyright 2010, all wrongs reversed. Peter Se

Re: Down with tinyurl! (was Re: importing excel data into a pythonmatrix?)

2010-09-20 Thread Seebs
On 2010-09-21, Steven D'Aprano wrote: > On Tue, 21 Sep 2010 03:01:53 +0000, Seebs wrote: >> On 2010-09-21, geremy condra wrote: >> Then I posted a question on an IRC channel. I had done a ton of >> searching already, and I started by explaining the top three >>

Re: Down with tinyurl! (was Re: importing excel data into a pythonmatrix?)

2010-09-20 Thread Seebs
On 2010-09-21, geremy condra wrote: > I use them when I want to conceal the target of the link. Usually here > that just means its a letmegooglethatforyou.com link, which I find > more amusing than is probably healthy. I thought the idea was funny at first. Then I posted a question on an IRC cha

Re: Too much code - slicing

2010-09-20 Thread Seebs
On 2010-09-21, Steven D'Aprano wrote: > On Mon, 20 Sep 2010 19:28:49 +0200, Antoon Pardon wrote: >> Not necessarily. Some of us have the impression that Guido deliberatly >> chose an ugly format for the ternary operator. > If he did, then he must have changed his mind, because there is nothing >

Re: Too much code - slicing

2010-09-20 Thread Seebs
On 2010-09-20, Antoon Pardon wrote: > Not necessarily. Some of us have the impression that Guido deliberatly > chose an ugly format for the ternary operator. Guido has alwasys been > against a ternary operator but the requests kept coming. So eventually > he introduced one. But the impression is t

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Seebs
On 2010-09-20, Tim Harig wrote: > You could simply place the filter in slrn; then, any urls that you see in > your reader would already be shown with the preview prefix suitable for cut > and paste mechanisms. If you wanted, you can even have your script > download the preview and automatically c

Re: [OT] Syntax highlighting [was Re: Too much code - slicing]

2010-09-20 Thread Seebs
On 2010-09-20, Steven D'Aprano wrote: > On Sun, 19 Sep 2010 07:36:11 +0000, Seebs wrote: >> No, but the syntax should be invisible. When I read English, I don't >> have to think about nouns and verbs and such unless something is very >> badly written. > That

Re: [OT] Speed-reading [was Re: Too much code - slicing]

2010-09-20 Thread Seebs
On 2010-09-20, Steven D'Aprano wrote: > I don't know about how other people speed-read, but I can assure you that > when my wife speed-reads, she's not just scanning a few words and > interpolating between them. She can give you a detailed summary of what > *actually* happened, not just a good

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-19 Thread Seebs
On 2010-09-20, Tim Harig wrote: > 1. Don't bother to manually paste when you can use something like urlview > to lauch directly. I don't know that this would actually be better than what I currently do, which is grab text and middle-click in another window. > If you want this behavio

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-19 Thread Seebs
On 2010-09-20, Tim Harig wrote: > On 2010-09-20, Seebs wrote: >> * No hint as to what site you'll be getting redirected to. > Tinyurl, in particular, allows you to preview the url if you choose to do > so. Other URL shortning services have a similar feature. I have no i

Re: Too much code - slicing

2010-09-19 Thread Seebs
On 2010-09-20, John Bokma wrote: > I didn't mean that there are spoilers in the first 70 pages, just that > to me the excercise would spoil the book, so, I wouldn't do it. I > consider a book like a meal, I wouldn't gobble down food, regurgitate > it, and eat it again at a slower pace. Books, movi

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-19 Thread Seebs
On 2010-09-20, Steven D'Aprano wrote: > On Sun, 19 Sep 2010 06:16:49 -0700, Aahz wrote: >> Please don't use tinyurl -- it's opaque and provides zero help to anyone >> who might later want to look it up (and also no accessibility if tinyurl >> ever goes down). At the very least, include the origin

Re: Too much code - slicing

2010-09-19 Thread Seebs
On 2010-09-20, John Bokma wrote: > Heh, to me speed reading those 70 pages in a very short while, > concluding that it's a good book, and start over again would be quite > the spoiler. I rarely encounter substantive spoilers in the first 70 pages or so of a book. That said, I'm pretty much immun

Re: Too much code - slicing

2010-09-19 Thread Seebs
On 2010-09-20, alex23 wrote: > AK wrote: >> When I was reading The book of the new sun, though, I could stop and >> read a single sentence a few times over and reflect on it for a minute. > Totally understandable, Wolfe is a far, far greater writer than > Rowling :) Certainly true. On the othe

Re: Too much code - slicing

2010-09-19 Thread Seebs
On 2010-09-19, Gregory Ewing wrote: > AK wrote: >> Afaik the idea is that you can read a novel at the speed of half a page >> a second or so and understand it to the same extent as people who'd read >> at a normal rate. > I've never understood why anyone would *want* to read a > novel that fast,

Re: Too much code - slicing

2010-09-19 Thread Seebs
On 2010-09-19, MRAB wrote: > On 19/09/2010 22:32, Seebs wrote: >> On 2010-09-19, AK wrote: >>> Because that's what 'if' and 'else' mean. >> My point is, I don't want the order of the clauses in if/else to change. >> If it is sometim

Re: Too much code - slicing

2010-09-19 Thread Seebs
On 2010-09-19, AK wrote: > Because that's what 'if' and 'else' mean. My point is, I don't want the order of the clauses in if/else to change. If it is sometimes "if else ", then it should *ALWAYS WITHOUT EXCEPTION* be condition first, then true clause, then false clause. If it's sometimes "if

Re: Too much code - slicing

2010-09-19 Thread Seebs
On 2010-09-19, AK wrote: > On 09/19/2010 03:31 AM, Seebs wrote: >> Just like: >> if condition: >> foo >> else: >> bar >> The condition is the primary, the clauses are secondary to it. > To me, the problem with C ternary i

Re: Too much code - slicing

2010-09-19 Thread Seebs
On 2010-09-19, Steven D'Aprano wrote: > I'm not entirely sure I agree with you here... you can't ignore syntax in > order to understand the meaning of code. No, but the syntax should be invisible. When I read English, I don't have to think about nouns and verbs and such unless something is very

Re: Too much code - slicing

2010-09-19 Thread Seebs
On 2010-09-19, Steven D'Aprano wrote: > Define "unbalanced". I'm not sure that's the word I'd use. I'm not even sure what it would mean here. > Putting aside the over-use of punctuation, The C syntax feels unbalanced > to me. You have: > condition IF true-clause ELSE false-clause > so both c

Re: Too much code - slicing

2010-09-18 Thread Seebs
On 2010-09-19, AK wrote: > On 09/18/2010 08:35 PM, Seebs wrote: >> That wouldn't be *syntax* highlighting, that'd be *semantic* highlighting. > In case of programming, the effect is similar. I have not found that to be the case. It's been exactly the same as syn

Re: Too much code - slicing

2010-09-18 Thread Seebs
On 2010-09-19, AK wrote: > Funny that you should say that, because I thought quite a few times that > it would be really awesome if some texts in English had syntax > highlighting. Obviously, not Brothers Karamazov, but something like a > tutorial, or a manual, or an online article. If key words w

Re: Too much code - slicing

2010-09-18 Thread Seebs
On 2010-09-18, AK wrote: > On 09/18/2010 06:56 PM, Seebs wrote: >> Basically, I can handle >> do x if y >> pretty well, but >> do x if y else z >> always breaks my parser. >> So in English, I might say "I'll go to the store if I have t

Re: Too much code - slicing

2010-09-18 Thread Seebs
On 2010-09-18, Steven D'Aprano wrote: > On Fri, 17 Sep 2010 16:01:54 -0400, Andreas Waldenburger wrote: >> On Thu, 16 Sep 2010 16:20:33 -0400 AK wrote: >>> I also like this construct that works, I think, since 2.6: >>> code = dir[int(num):] if side == 'l' else dir[:-1*int(num)] >> I wonder when

Re: C interpreter in Lisp/scheme/python

2010-07-15 Thread Seebs
On 2010-07-15, bolega wrote: > This makes some sense. He replied on the newsgroup in a lengthy post > that there are sufficient resources out there giving hint that no one > need help me out. Then I was called "lazy" in one email and tersely > given JUST the last name of an author who has many boo

<    1   2   3