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: 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: 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: 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: 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: "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: (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: 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: "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: "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-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, 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: > 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, 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, 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, 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, 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, Keith Thompson wrote: > Seebs writes: >> On 2010-09-30, Paul Rubin wrote: >>> int maximum(int a, int b); >>> int foo() { >>> int (*barf)() = maximum; >>> return barf(3); >>> } > That first line

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, Ian Collins wrote: > Which is why agile practices such as TDD have an edge. If it compiles > *and* passes all its tests, it must be right. So far as I know, that actually just means that the test suite is insufficient. :) Based on my experience thus far, anyway, I am pretty sur

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, RG wrote: > That gives (what I would consider to be) false positives, e.g.: > [...@mighty:~]$ cat foo.c > void foo(long x) {} > int main() { foo(1); } > [...@mighty:~]$ gcc -Wconversion foo.c > foo.c: In function ???main???: > foo.c:4: warning: passing argument 1 of ???foo??? wit

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, RG wrote: > I don't want to quibble over terminology. May I suggest that, if you don't want to use words and terminology precisely, perhaps computer programming is not for you? > Whatever label you choose to > put on it ("false positive", "not being able to express some things >

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-10-01, Don Geddis wrote: > 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. I would agree that the third sentence is arguably

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, TheFlyingDutchman wrote: >> > ? ? ? ? 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. >> I would agree that the third se

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, Pascal J. Bourguignon wrote: > Seebs writes: >> The obvious simple maximum() in C will not raise an exception nor return >> something which isn't an int in any program which is not on its face >> invalid in the call. This is by definite contrast with sev

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, Pascal J. Bourguignon wrote: > static dynamic > > compiler detects wrong type fail at compile fails at run-time > (with exception >

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, RG wrote: > Again, you can't have it both ways. Either a warning is a "compiler > error" according to the claim at issue (see below) or it is not. If it > is, then this is a false positive. No, it isn't. It's a correctly identified type mismatch. You keep moving the goal post

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, Steven D'Aprano wrote: > Now can we (by which I mean *you*) stop cross-posting C talk to multiple > newsgroups that don't have anything to do with C? Fair enough. The original thread does seem to have been crossposted in an innovative way. -s -- Copyright 2010, all wrongs rever

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, Pascal J. Bourguignon wrote: > Seebs writes: >> On 2010-10-01, Pascal J. Bourguignon wrote: >>> compiler passes wrong type wrong resultfails at run-time >>> (the programmer (with exception >>>

Re: How to find free resident memory in Linux using python

2010-10-02 Thread Seebs
On 2010-10-02, Sandy wrote: > I want to find how much free memory (RAM) is available in my system > using python. The question is essentially incoherent on modern systems. You'd have to define terms. Consider that on a given system, it's quite possible that gigabytes of space are being used to

Re: SQLite is quite SQL compliant

2010-10-02 Thread Seebs
On 2010-10-02, Ravi wrote: > The documentation of the sqlite module at > http://docs.python.org/library/sqlite3.html > says: > "...allows accessing the database using a nonstandard variant of the > SQL..." > But if you see SQLite website they clearly say at > http://sqlite.org/omitted.html > t

Re: sequence multiplied by -1

2010-10-02 Thread Seebs
On 2010-10-03, Steven D'Aprano wrote: > On Sat, 02 Oct 2010 12:50:02 -0700, Dennis Lee Bieber wrote: >> Well... We could maybe borrow from REXX... and >> use || for concatenation. >|| for concatenation? What's the connection between the pipe character > and concatenation? Th

Re: SQLite is quite SQL compliant

2010-10-03 Thread Seebs
On 2010-10-03, Lawrence D'Oliveiro wrote: > In message , Seebs wrote: >> sqlite is a source of joy, a small bright point of decent >> and functional software in a world full of misbehaving crap. > Have you learnt how to be selective in your downloads yet? Sadly, as a si

Re: how to get partition information of a hard disk with python

2010-10-04 Thread Seebs
On 2010-10-05, Lawrence D'Oliveiro wrote: > In message , Anssi Saari wrote: >> Because for the common case it's simple and easy and one might learn >> something interesting? > You consider it ???interesting??? to reinvent stuff that others have already > done? That isn't what the other poster s

Re: I don't get why sys.exit(1) doesn't exit the while loop in the follow case

2010-10-04 Thread Seebs
On 2010-10-05, Lawrence D'Oliveiro wrote: > In message <[email protected]>, Ben Finney wrote: >> Don't ever use a bare ???except??? unless you know exactly why you're doing >> so. > In other news, don???t ever put a loaded gun in your mouth and pull the > trigger unless you know exa

Re: suggestions please "what should i watch for/guard against' in a file upload situation?"

2010-10-06 Thread Seebs
On 2010-10-06, geekbuntu wrote: > in general, what are things i would want to 'watch for/guard against' > in a file upload situation? This question has virtually nothing to do with Python, which means you may not get very good answers. > my checklist so far is basically to check the extension -

Re: help!!!

2010-10-06 Thread Seebs
On 2010-10-06, Diez B. Roggisch wrote: > writes: >> plz can u convert this cpp file into python i need that badly as soon as >> possible... I am new to python. I just wanna learn it > For such an aspiring student of the art of computer programming, I have > the strange feeling of lack-of-eff

Re: suggestions please "what should i watch for/guard against' in a file upload situation?"

2010-10-06 Thread Seebs
On 2010-10-06, Diez B. Roggisch wrote: > Seebs writes: >> On 2010-10-06, geekbuntu wrote: >>> in general, what are things i would want to 'watch for/guard against' >>> in a file upload situation? >> This question has virtually nothing to do with Pytho

Re: help!!!

2010-10-06 Thread Seebs
On 2010-10-06, Diez B. Roggisch wrote: > With an impressive amount of technological experience under his belt. So > I'm a bit aghast to see him struggle with this rather simple > problem. Thus my question... It does seem a bit odd. I mean, if I had a short time line to get something converted to

Re: help!!!

2010-10-06 Thread Seebs
On 2010-10-06, Diez B. Roggisch wrote: > From the look of it... he's just trying to get a freebie on a homework > assignment. It certainly is no commercial/useful piece of code > whatsoever... just CS-101 "read data from stdin and do stuff". Ooh, I should go help, then. I *love* to help people o

Re: help!!!

2010-10-06 Thread Seebs
On 2010-10-06, wrote: > plz can u convert this cpp file into python i need that badly as soon as > possible... I am new to python. I just wanna learn it Having come to realize that this is a homework problem, I would of course be glad to. The original program: #include int

Re: help!!!

2010-10-06 Thread Seebs
On 2010-10-07, John Nagle wrote: > First, "scanf" was deprecated over five years ago. It was? I mean, people have been telling me not to use it since the 80s, but I wasn't aware that it had been deprecated, except in the sense of being derided and dismissed as of no value. -s -- Copyright

Re: list parameter of a recursive function

2010-10-06 Thread Seebs
On 2010-10-07, TP wrote: > Diez B. Roggisch wrote: >> A safer alternative for these cases is using tuples, because they are >> immutable. > The problem with tuples is that it is not easy to modify them: This is probably the best post-and-response I've seen in the last couple of months. -s -- C

Re: PYTHON

2010-10-08 Thread Seebs
On 2010-10-08, k.. wrote: > PLEASE LEARN ME PYTHON Done! Please be sure to drop by sometimes to let us know how it's going, now that we've learned you Python. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / [email protected] http://www.seebs.net/log/ <-- lawsuits, rel

Re: Testing for changes on a web page (was: how to find difference in number of characters)

2010-10-09 Thread Seebs
On 2010-10-09, harryos wrote: > What I meant by number of characters was the number of edits happened > between the two versions.. Consider two strings: Hello, world! Yo, there. What is the "number of edits happened between the two versions"? It could be: * Zero. I just typed them both from

Re: help!!!

2010-10-11 Thread Seebs
On 2010-10-11, Lawrence D'Oliveiro wrote: > In message , Seebs wrote: >> ... but I wasn't aware that it had been deprecated, except in the sense of >> being derided and dismissed as of no value. > What more did you want? :) Well, formal "deprecation"

My first Python program

2010-10-12 Thread Seebs
So, I'm new to Python, though I've got a bit of experience in a few other languages. My overall impressions are pretty mixed, but overall positive; it's a reasonably expressive language which has a good mix between staying out of my way and taking care of stuff I don't want to waste attention on.

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-12, Jonas H. wrote: > Just a few pointers, looks quite good to me for a newbie :) Thanks! > * Less action in __init__. I'm a bit curious about this. The __init__ functions in this are, at least for now, pretty much doing only what's needed to create the objects from their inputs. >

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-12, Chris Rebert wrote: > 2. > self.f = file(path, 'r') > if not self.f: > return None > > The "if" here is pointless; I'm reasonably sure files are always > considered boolean true. I actually seem to have done this wrong anyway -- I was thinking in terms of the C-like idiom of re

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-12, MRAB wrote: > The code does require Python 2 and the use of except ... as ... requires > at least version 2.6. Whoops. > Line 51 > The __init__ method should always return None. There's no need to be > explicit about it, just use a plain "return". The real issue here is that I

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-12, Hallvard B Furuseth wrote: >> list = map(lambda x: x.call(), self.args) >> return ', '.join(list) > > return ', '.join([x.call() for x in self.args]) I think I wrote that before I found out about list comprehensions. How new are list comprehensions? I do like that, it's clearer

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-13, Chris Rebert wrote: > For future reference, the significant majority of things in Python > raise exceptions upon encountering errors rather than returning error > values of some sort. Yes. I'm getting used to that -- it's a bit of a shift, because I'm used to exceptions being *exc

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-13, Jean-Michel Pichavant wrote: > If you wonder about some defects reported by such linters, you can then > ask in this list why something is not that good, because it may not be > always obvious. > 'pylint' is one them, pretty effective. Okay, several questions about stuff pylint

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-13, Jonas H. wrote: > Not really. Files will be closed when the garbage collector collects the > file object, but you can't be sure the GC will run within the next N > seconds/instructions or something like that. So you should *always* make > sure to close files after using them. Tha

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-13, Chris Torek wrote: > Unfortunately "with" is newish and this code currently has to > support python 2.3 (if not even older versions). I think it might be 2.4 and later. I'm not sure. Of course, this being the real world, the chances that I'll be able to stick with "Python 2" and

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-13, Ben Finney wrote: > Python borrows from C in that consecutive literal strings are > concatenated in the bytecode:: > > stderr.write( > "WARNING:" > " Pants on fire\n") Hmm. So I just indent stuff inside the ()s or whatever? I can work with that. -s -- Copyri

Re: what happens to Popen()'s parent-side file descriptors?

2010-10-13 Thread Seebs
On 2010-10-13, Roger Davis wrote: > Hi, I am new to this group, please forgive me if this is a repeat > question. I am a new Python programmer but experienced in C/Unix. I am > converting a shell script to Python which essentially loops > infinitely, each pass through the loop running commands lik

Re: Does everyone keep getting recruiting emails from google?

2010-10-14 Thread Seebs
On 2010-10-14, Daniel Fetchinson wrote: > I keep getting recruiting emails from [email protected] about > working for google as an engineer. I've gotten one of those, ever, and it named a specific person who had referred me. (It turns out to be a moot point, $DAYJOB has telecommuting, and

Re: My first Python program

2010-10-14 Thread Seebs
On 2010-10-14, Hallvard B Furuseth wrote: > A class which holds an OS resource like a file, should provide a context > manager and/or a release function, the latter usually called in a > 'finally:' block. When the caller doesn't bother with either, the class > often might as well depend on the de

Re: what happens to Popen()'s parent-side file descriptors?

2010-10-14 Thread Seebs
On 2010-10-14, Roger Davis wrote: > Seebs, you are of course correct that the example I quoted (`cat | > grep | whatever`) is best done internally with the re module and built- > in language features, and in fact that has already been done wherever > possible. I should have pic

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Seebs
On 2010-10-15, Grant Edwards wrote: > On 2010-10-15, Steven D'Aprano wrote: >> In the Unix world, which includes OS X, text tools tend to have >> difficulty with tabs. Or try naming a file with a newline or carriage >> return in the file name, or a NULL byte. > How do you create a file with a n

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Seebs
On 2010-10-15, Grant Edwards wrote: > Yes, all of the Unix syscalls use NULL-terminated path parameters (AKA > "C strings"). What I don't know is whether the underlying filesystem > code also uses NULL-terminated strings for filenames or if they have > explicit lengths. If the latter, there migh

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-17 Thread Seebs
On 2010-10-17, Dun Peal wrote: > What's the fastest way to implement `all_ascii(L)`? Start by defining it. > 1. Match against a regexp with a character range: `[ -~]` What about tabs and newlines? For that matter, what about DEL and BEL? Seems to me that the entire 0-127 range are "ASCII char

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Seebs
On 2010-10-18, Aahz wrote: > In article <[email protected]>, > Steven D'Aprano wrote: >>[duplicate post] > Maybe, but there's no reason for posting that ten times! ;-) I would guess that there is almost certainly a reason. My first candidate would be "buggy

pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
So, I'm messing around with pylint. Quite a lot of what it says is quite reasonable, makes sense to me, and all that. There's a few exceptions. One: I am a big, big, fan of idiomatic short names where appropriate. For instance: catch , e: I don't want a long, verbose, name -- "e" is abo

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Steven D'Aprano wrote: > On Tue, 19 Oct 2010 19:57:36 +0000, Seebs wrote: >> One: I am a big, big, fan of idiomatic short names where appropriate. >> For instance: >> catch , e: > That would be except, not catch. Er, yeah, that. > Well, t

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Shawn Milochik wrote: > Just to be pedantic (or maybe even helpful), the use of the comma > after the exception is deprecated in favor of 'as.' Not in code that has to run on older Pythons. I'm pretty sure I have to work with everything from 2.4 to 2.6 or so. That reminds me, tho

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Martin P. Hellwig wrote: > Well, as with all styles IMHO, if there is a _good_ reason to break it, > then by all means do, but you might want to consider putting in a > comment why you did that and add the #pylint: disable-msg= > on that line. If that is overkill, why not just co

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Martin P. Hellwig wrote: > Speaking without context here, so take it with as much salt as required > ;-), it is not that unusual. However there are some things to consider, > for example are all these attributes related to each other? If so > wouldn't it be more pythonic to have

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Ben Finney wrote: > Tools like pylint are far more useful if every message they emit is > something that you must deal with, rather than ignore every time you see > it. That way, it's feasible to get the output to no messages at all, and > have a defensible reason for every disabled

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Alexander Kapps wrote: > The general idea is, that modules, classes, methods, and functions > should be small so they are better reusable, manageable and > understandable. Makes sense. > If you have a huge class or function with many > attributes or local variables, it's often

Re: Code smells: too many parameters, too many attributes (was: pylint -- should I just ignore it sometimes?)

2010-10-19 Thread Seebs
On 2010-10-20, Ben Finney wrote: > It's a code smell. Many discrete attributes is a sign that the design > can be improved by combining related attributes into a complex type. Ahh. I think that makes sense. In this case, I don't think it's worth it, but I can see why it would be in some cases.

Re: pylint -- should I just ignore it sometimes?

2010-10-20 Thread Seebs
On 2010-10-20, Jean-Michel Pichavant wrote: > except ValueError, e: > Use meaningful names, this is so important. It's important, but meaning can come from idiom, not from the word used. > 'e' is not meaningful. Sure it is. It's like i for a loop index. There's a reason mathematicians use x

Re: pylint -- should I just ignore it sometimes?

2010-10-20 Thread Seebs
On 2010-10-20, Matteo Landi wrote: > Another situation in which I needed to disable such kind of warnings > is while working with graphics modules. > I often use variable names such as x, y, z for coordinates, or r,g,b for > colors. > Would longer names make the reader's life easier? Interesting

Re: pylint -- should I just ignore it sometimes?

2010-10-21 Thread Seebs
On 2010-10-21, Martin P. Hellwig wrote: > Although intuitively I would say the shorthand, however that is > depending on the context being me knowing at least the basics of 3d > spaces and having the pre-warning that you are going to mention > something with either coordinates or colours. > Ta

Re: pylint -- should I just ignore it sometimes?

2010-10-21 Thread Seebs
On 2010-10-21, Jean-Michel Pichavant wrote: > In the middle of thousand lines of code, when you are reviewing or > debugging, the later is better TMO, the point is that x, y, z = is only > easy to read during the assignement. Bull. > x, y, z = p.nextpoint() > [snip a dozen of code line] > ...

Re: pylint -- should I just ignore it sometimes?

2010-10-21 Thread Seebs
On 2010-10-21, Jean-Michel Pichavant wrote: > Let me quote the paper I linked in the previous post: > > list1 = [] > for x in theList: > if x[0] == 4: > list1 += x; > return list1 > > compare it to: > > flaggedCells = [] > for cell in theBoard: > if cell[STATUS_VALUE] == FLAGGED:

Re: pylint -- should I just ignore it sometimes?

2010-10-21 Thread Seebs
On 2010-10-21, Jean-Michel Pichavant wrote: > It can be short if descriptive: > for o, c in cars: > park(o) > phone(c) > for owner, car in cars: # by just using meaningful names you give the > info to the reader that you expect cars to be a list of tuple (owner, car) > park(owner) >

Re: pylint -- should I just ignore it sometimes?

2010-10-22 Thread Seebs
On 2010-10-22, Jean-Michel Pichavant wrote: > Seebs wrote: >> The one that brought this up, though, was "except FooError, e:", and in >> that case, there is no need for any further description; the description >> is provided by the "except", and

Re: pylint -- should I just ignore it sometimes?

2010-10-22 Thread Seebs
On 2010-10-22, Jean-Michel Pichavant wrote: > Seebs wrote: >> On 2010-10-21, Jean-Michel Pichavant wrote: >>> list1 = [] >>> for x in theList: >>> if x[0] == 4: >>> list1 += x; >>> return list1 >>> flaggedCells = [] >

Re: pylint -- should I just ignore it sometimes?

2010-10-22 Thread Seebs
On 2010-10-22, Jean-Michel Pichavant wrote: >> I'm all for descriptive names, but there's a great deal of benefit to >> knowing when a descriptive name will help, and when all you need is a >> variable which will be quickly recognized. >> Compare: >> [theValueInTheList.func() forTheValueInTheList

Re: Unicode questions

2010-10-25 Thread Seebs
On 2010-10-25, Lawrence D'Oliveiro wrote: > In message , Petite > Abeille wrote: >> Characters vs. Bytes > And why do certain people insist on referring to bytes as ???octets One common reason is that there have been machines on which "bytes" were not 8 bits. In particular, the usage of "b

Re: Why "flat is better than nested"?

2010-10-26 Thread Seebs
On 2010-10-26, kj wrote: > (Though, humorless as it is of me, I still would prefer the ZoP > out of the standard library, to save myself having to tell those > who are even newer to Python than me not to take it seriously.) Well, not to take it *too* seriously. It's like any other Zen -- it's wo

Re: Python changes

2010-10-28 Thread Seebs
On 2010-10-28, Craig McRoberts wrote: >I've already resigned >myself to starting over from the beginning, but are my books from >that time period even worth using now? Impression I get is mostly "no". I think you'll find life overall a lot better now, though. Programming languages tend to impro

Re: Compare source code

2010-11-01 Thread Seebs
On 2010-11-01, Grant Edwards wrote: > On 2010-11-01, Lawrence D'Oliveiro wrote: >> In message <[email protected]>, Peter Pearson wrote: >>> Warning: "diff -b" won't detect changes in indentation. Changes in >>> indentation can change a Python program. >> I'm getting less and less

Re: *** FBI gets a warm welcome in Chicago for their EXCELLENTperformance - cheers to NEW CONS ***

2010-11-02 Thread Seebs
On 2010-11-02, [email protected] wrote: > How exactly does this relate to python? 1. It doesn't. It's spam. Duh. 2. Don't respond to spam. 3. Don't top-post. 4. If I see even one more post from you where the entire previous post is quoted under your text, I will plonk you. I warn you now be

Re: Compare source code

2010-11-02 Thread Seebs
On 2010-11-02, D'Arcy J.M. Cain wrote: > You have problems. Indentation as syntax isn't one of them. In the absence of indentation as syntax, they haven't bugged me. > "No one > knows why" email is being "magically" transformed? Yay for a large company IT department with both MS and Blackberry

Re: Compare source code

2010-11-02 Thread Seebs
On 2010-11-02, Steven D'Aprano wrote: > I've lost more time to reading people's bitching about indentation than I > have dealing with indentation problems. Doesn't totally surprise me. :) > But then, I don't insist on using tools which are broken by design. Neither do I. > If your email serv

Re: Compare source code

2010-11-02 Thread Seebs
On 2010-11-02, Grant Edwards wrote: > True, but the fact that diff has an option that for Python sources > will produces useless results doesn't seem like a valid indictment of > Python's syntax and semantics. The question is *why* diff has that option. The answer is because whitespace changes (

Re: Compare source code

2010-11-02 Thread Seebs
On 2010-11-02, Grant Edwards wrote: > And you think compatibility with your broken e-mail server is a good > reason to change the syntax of a programming language? No. I never said that. >> Many editors helpfully convert spaces to tabs by default some or all >> of the time. And so on. > Such

Re: Compare source code

2010-11-02 Thread Seebs
On 2010-11-02, Emile van Sebille wrote: > What is right is that there's no question that quux is subsequent to baz > in all cases barring exceptions (and assuming no tabs intermixed) Yes, but that doesn't mean it does what the programmer intended, just that it does what it does. > The apparent

Re: Compare source code

2010-11-02 Thread Seebs
On 2010-11-02, D'Arcy J.M. Cain wrote: > "Large" is no excuse for incompetency. It is in practice. > So configure it to recognize Python files and act accordingly. So far as I know, it doesn't have a feature to do this. In any event, I work around it okay. >> No, they aren't. See... That wou

Re: Compare source code

2010-11-02 Thread Seebs
On 2010-11-02, Tim Harig wrote: > This is Python's most noticable blemish outside of the community. > Everybody knows that Python is the language that forces you to use a > particular style of formatting; and, that is a turn-off for many people. Honestly, I could probably live with that; the kill

Re: Compare source code

2010-11-02 Thread Seebs
On 2010-11-02, Grant Edwards wrote: > Huh? Indentation is invisible? You can't see the indentation in > Python source code? The difference between tabs and spaces is invisible on a great number of the devices on which people display code. Indentation is visible, but the underlying structure of

Re: Compare source code

2010-11-02 Thread Seebs
On 2010-11-03, D'Arcy J.M. Cain wrote: > On 03 Nov 2010 01:20:40 GMT > Seebs wrote: >> However, I have probably seen all of two or three bugs ever related to >> mis-indented C, and I've had various things screw up or wreck indentation > Really? I have

Re: Trouble with importing

2010-11-02 Thread Seebs
On 2010-11-02, Ben Ahrens wrote: > I did indeed continue to top-post, and you should plonk me. Edited for accuracy. Done. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / [email protected] http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia

Re: Compare source code

2010-11-03 Thread Seebs
On 2010-11-03, Steven D'Aprano wrote: > On Wed, 03 Nov 2010 02:40:11 +0000, Seebs wrote: >> Sure, but there's also no way for you to spot that something looks >> suspicious. In Python, if something is misindented, it does what you >> told it to do, and there'

Re: Compare source code

2010-11-03 Thread Seebs
On 2010-11-03, Steven D'Aprano wrote: > On Wed, 03 Nov 2010 01:25:56 +0000, Seebs wrote: >> Whitespace damage is, indeed, wrong. It's a bad thing. It is an >> *extremely common* bad thing, > I question that. > You've claimed that you have to deal with brok

Re: Compare source code

2010-11-03 Thread Seebs
On 2010-11-03, Steven D'Aprano wrote: > On Tue, 02 Nov 2010 19:26:56 +, Tim Harig wrote: >> I agree with Seebs, Python is the only language I know that promotes the >> use of spaces over tabs; > Really? Yes. > I'm not aware of *any* language that promot

Re: Compare source code

2010-11-03 Thread Seebs
On 2010-11-03, Grant Edwards wrote: > On 2010-11-03, Seebs wrote: >> Explicit is better than implicit. It is *better* to explicitly mark the >> ends of things than to have it be implicit in dropping indentation. That's >> not a burden, it's good engineerin

Re: Compare source code

2010-11-03 Thread Seebs
On 2010-11-03, Steven D'Aprano wrote: > Yes. How does that contradict what I said? Once you understand that you do have to break the rules occasionally, it is a good idea to design things that will be robust when the rules are broken. > Ah, argument by misunderstanding the Zen! I see. So expli

<    1   2   3   >