Re: How to tell when a socket is closed on the other end?

2007-07-25 Thread Roy Smith
In article [EMAIL PROTECTED], billiejoex [EMAIL PROTECTED] wrote: Hi there. I'm setting up test suite for a project of mine. From test suite, acting as a client, I'd like to know, in certain situations, if the socket is closed on the other end or not. I noticed that I can detect such state

Re: How to tell when a socket is closed on the other end?

2007-07-26 Thread Roy Smith
Jay Loden [EMAIL PROTECTED] wrote: The goal of this portion of the test suite we are writing for the project is to determine if a remote server is behaving properly by closing a socket from the server side based on a client-side command. Really what's needed is a way to make sure the

Re: Test driven development

2008-01-24 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: So my question is when approaching a project that you want to employ test driven development on how and where do you start? And also if anyone uses top-down design with TDD I would be interested in how you do it (does it involve lots of

Re: Python Standardization: Wikipedia entry

2008-01-27 Thread Roy Smith
In article [EMAIL PROTECTED], ajaksu [EMAIL PROTECTED] wrote: On Jan 27, 10:32 pm, Paddy [EMAIL PROTECTED] wrote: I would value the opinion of fellow Pythoneers who have also contributed to Wikipedia, on the issue of Is Python Standardized. Specifically in the context of this table:

Re: Python Standardization: Wikipedia entry

2008-01-28 Thread Roy Smith
In article [EMAIL PROTECTED], Terry Reedy [EMAIL PROTECTED] wrote: Paddy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] |I would value the opinion of fellow Pythoneers who have also | contributed to Wikipedia, on the issue of Is Python Standardized. Depends entirely on the

Re: Python Standardization: Wikipedia entry

2008-01-29 Thread Roy Smith
In article [EMAIL PROTECTED], Terry Reedy [EMAIL PROTECTED] wrote: Roy Smith [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | But, surely Python has plenty of implementation defined aspects. | Especially in the libraries. I personally do not consider the libraries as part

Re: Does anyone else use this little idiom?

2008-02-02 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Ruby has a neat little convenience when writing loops where you don't care about the loop index: you just do n.times do { ... some code ... } where n is an integer representing how many times you want to execute some code. In Python,

Re: Python Written in C?

2008-07-20 Thread Roy Smith
In article [EMAIL PROTECTED], Mensanator [EMAIL PROTECTED] wrote: C isn't a high level language, that's part of its problem. C is the highest level assembler language I've ever used. And I've used a few. It really is cool that you can add two 32-bit integers and not have to worry about

Re: Insert string into string

2008-07-26 Thread Roy Smith
In article [EMAIL PROTECTED], Francesco Pietra [EMAIL PROTECTED] wrote: I am posting ex novo as it became confusing to me. I take the opportunity to ask advice for a second problem. FIRST PROBLEM For file xxx.pdb, insert letter A into each line that starts with ATOM. A should be inserted

Re: [unittest] Run setUp only once

2008-07-29 Thread Roy Smith
In article [EMAIL PROTECTED], Nikolaus Rath [EMAIL PROTECTED] wrote: But at least this variation doesn't work, because unittest apparently also creates two separate TwoTests instances for the two tests. Isn't there some way to convince unittest to reuse the same instance instead of trying to

Re: Python String Immutability Broken!

2008-08-24 Thread Roy Smith
In article [EMAIL PROTECTED], Hendrik van Rooyen [EMAIL PROTECTED] wrote: It is reputed to belong to a programmer who was flayed alive Reminds me of that great old song from Saturday Night Hacker: Oh, oh, oh, oh. Flaying alive, flaying alive. Oh, oh, oh, oh. Flaying ali-i-i-i-i-ive! --

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-29 Thread Roy Smith
Terry Reedy [EMAIL PROTECTED] wrote: Yes, so you can write something like either your second example or l = [ kjasldfjs, kjsalfj, ksjdflasj, ] and insert items without worrying about leaving out the comma (less of a problem with 'horizontal' list), or delete the last line and

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-29 Thread Roy Smith
In article [EMAIL PROTECTED], Grant Edwards [EMAIL PROTECTED] wrote: On 2008-08-29, Roy Smith [EMAIL PROTECTED] wrote: Exactly. This is one of those little pieces of syntactic sugar which makes python so nice to work with. The alternative is (in C, for example) abominations like

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-30 Thread Roy Smith
In article [EMAIL PROTECTED], Fredrik Lundh [EMAIL PROTECTED] wrote: Roy Smith wrote: Yowza, you're right (at least for the one case I tried). This must be a new development (where new development is defined as, It wasn't legal in the original KR C I learned when I was a pup

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Roy Smith
In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: Without them it looks better: import sys for line in sys.stdin: try: a, b = map(int, line.split(None, 2)[:2]) except ValueError: pass else: if a + b == 42: print b I'm

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Roy Smith
In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: I might take it one step further, however, and do: fields = line.split()[:2] a, b = map(int, fields) in fact, I might even get rid of the very generic, but conceptually overkill, use of map() and

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Roy Smith: No reason to limit how many splits get done if you're explicitly going to slice the first two. You are probably right for this problem, because most lines are 2 items long, but in scripts that have to process lines

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Roy Smith
In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: Roy Smith wrote: In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: I might take it one step further, however, and do: fields = line.split()[:2] a, b = map(int, fields

Re: Advice on long running processes

2007-10-11 Thread Roy Smith
[EMAIL PROTECTED] wrote: Hello, I write a lot of CGI scripts, in Python of course. Now I need to convert some to long-running processes. I'm having trouble finding resources about the best practices to do that. I've found a lot of email discussions that say something like, You need to

Re: Can you determine the sign of the polar form of a complex number?

2007-10-17 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Just to clarify what I'm after: If you plot (-3)^n where n is a set of negative real numbers between 0 and -20 for example, then you get a discontinuos line due to the problem mentioned above with fractional exponents. However, you can

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Roy Smith
chewie54 [EMAIL PROTECTED] wrote: I would prefer to use Python but can't deny how popular Tcl is, as mentioned above, so my question is why wasn't Python selected by these companies as the choice of scripting languages for their product? Are there any obvious advantages like:

Re: Clean way to get one's network IP address?

2007-11-21 Thread Roy Smith
Gilles Ganault [EMAIL PROTECTED] wrote: I know about socket.gethostbyname, but this relies on what's in /etc/hosts, and I'd rather have a more independent solution. The system I'm currently working on uses exactly this strategy -- we get the hostname then do a name lookup on it. We've gone

Re: the annoying, verbose self

2007-11-27 Thread Roy Smith
In article [EMAIL PROTECTED], Bruno Desthuilliers [EMAIL PROTECTED] wrote: Steven D'Aprano a écrit : On Mon, 26 Nov 2007 21:48:36 +0100, Ton van Vliet wrote: On Mon, 26 Nov 2007 20:14:50 +0100, Bruno Desthuilliers [EMAIL PROTECTED] wrote: However, I was more thinking in terms of

Re: Limit Guessing Algorithm

2007-12-02 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello hello, I'm looking for a piece of code, preferably in Python, that will do the following. It will accept a few data points (x,f(x)) of a function that converges to some finite value when x converges to

Re: Python surpasses Perl in TIOBE index

2007-12-04 Thread Roy Smith
In article [EMAIL PROTECTED], Daniel Fetchinson [EMAIL PROTECTED] wrote: Anyone has an idea what the huge peak around the middle of 2004 can be attributed to? There's a Q/A section at the bottom of http://www.tiobe.com/index.htm?tiobe_index which covers this: Q: What happened to Java in

Re: Distinguishing attributes and methods

2007-12-08 Thread Roy Smith
In article [EMAIL PROTECTED], Bruno Desthuilliers [EMAIL PROTECTED] wrote: MonkeeSage a écrit : On Dec 8, 2:51 pm, Glenn Hutchings [EMAIL PROTECTED] wrote: On Dec 8, 7:44 pm, MonkeeSage [EMAIL PROTECTED] wrote: I think it muddies the water to say that a.a() and a.a are the same

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Roy Smith
Ben Finney [EMAIL PROTECTED] wrote: a = enum ('foo', 'bar', 'baz') b = enum ('foo', 'bar', 'baz') Two separate enumerations are created OK, most of the rest follows from that. str (a) Not defined in the current specification. Suggestions? Well, by analogy with a = set ((1, 2, 3))

Re: Use empty string for self

2006-02-28 Thread Roy Smith
[EMAIL PROTECTED] wrote: Any comments? Has this been discussed before? Yes. To death. Executive summary: self is here to stay. -- http://mail.python.org/mailman/listinfo/python-list

Re: Use empty string for self

2006-02-28 Thread Roy Smith
Terry Hancock [EMAIL PROTECTED] wrote: However, there is a slightly less onerous method which is perfectly legit in present Python -- just use s for self: This is being different for the sake of being different. Everybody *knows* what self means. If you write your code with s instead of

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Roy Smith
In article [EMAIL PROTECTED], greg [EMAIL PROTECTED] wrote: Paul Rubin wrote: Do you anticipate having parameters like socket.AF_INET that are currently integers, become enumeration members in future releases? Since these are derived from values defined as integers in C, it's probably

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Roy Smith
Tim Chase [EMAIL PROTECTED] wrote: Do you anticipate having parameters like socket.AF_INET that are currently integers, become enumeration members in future releases? Since these are derived from values defined as integers in C, it's probably better to leave them that way. There may be

Re: Use empty string for self

2006-03-01 Thread Roy Smith
John Salerno [EMAIL PROTECTED] wrote: I do get it. I think I will just have to get used to seeing the 'self' argument but understanding that it's not really something that is always passed in. I'm trying to train myself to see def doittoit(self) as def doittoit() That's OK as far as using

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Roy Smith
Should I amend the PEP to propose either in the builtins or in the collections module? Or should I propose two PEPs and let them compete? I see the issue of whether it's a built-in or part of the standard library as being a detail. My personal opinion is that they're important enough to be

Re: do design patterns still apply with Python?

2006-03-02 Thread Roy Smith
In article [EMAIL PROTECTED], John Salerno [EMAIL PROTECTED] wrote: Since Python does so many things different, especially compared to compiled and statically typed languages, do most of the basic design patterns still apply when writing Python code? If I were to read a design pattern

Re: do design patterns still apply with Python?

2006-03-02 Thread Roy Smith
In article [EMAIL PROTECTED], Paul Rubin http://[EMAIL PROTECTED] wrote: Somewhat less often, something is easy in Java and difficult in Python. Example? -- http://mail.python.org/mailman/listinfo/python-list

Re: do design patterns still apply with Python?

2006-03-02 Thread Roy Smith
In article [EMAIL PROTECTED], Paul Rubin http://[EMAIL PROTECTED] wrote: Roy Smith [EMAIL PROTECTED] writes: Somewhat less often, something is easy in Java and difficult in Python. Example? Sandboxed code is a real obvious one. What is sandboxed code? -- http://mail.python.org

Re: Question

2006-03-02 Thread Roy Smith
In article [EMAIL PROTECTED], Tom Leggio [EMAIL PROTECTED] wrote: Do I need this on my computer---Python---can I remove it without hurting anything? Thanks Tommy Tom, That's a very difficult question to answer without knowing more about your computer. Some systems depend on Python for

Re: do design patterns still apply with Python?

2006-03-03 Thread Roy Smith
In article [EMAIL PROTECTED], msoulier [EMAIL PROTECTED] wrote: For example, the Factory pattern is mostly to work around the fact that it's difficult in Java and C++ to dynamically load classes. You're over-specifying. Most of most design patterns is to work around the fact that it's

Re: How to except the unexpected?

2006-03-03 Thread Roy Smith
In article [EMAIL PROTECTED], Ben Caradoc-Davies [EMAIL PROTECTED] wrote: James Stroud wrote: except URLError, HTTPException: Aieee! This catches only URLError and binds the name HTTPException to the detail of that error. You must write except (URLError, HTTPException): to catch

Re: How to except the unexpected?

2006-03-04 Thread Roy Smith
Rene Pijlman [EMAIL PROTECTED] wrote: A catchall seems like a bad idea, since it also catches AttributeErrors and other bugs in the program. All of the things like AttributeError are subclasses of StandardError. You can catch those first, and then catch everything else. In theory, all

Re: How to except the unexpected?

2006-03-04 Thread Roy Smith
In article [EMAIL PROTECTED], Rene Pijlman [EMAIL PROTECTED] wrote: Roy Smith: In theory, all exceptions which represent problems with the external environment (rather than programming mistakes) should derive from Exception, but not from StandardError. Are you sure? The class

Re: Why I chose Python over Ruby

2006-03-05 Thread Roy Smith
Xavier Morel [EMAIL PROTECTED] wrote: Francois wrote: 1) In Ruby there is a risk of Variable/Method Ambiguity when calling a method with no parameters without using () : Yes, but that's in my opinion a programmer error, not necessarily a language error. In Python, you can make exactly

Re: Why I chose Python over Ruby

2006-03-06 Thread Roy Smith
In article [EMAIL PROTECTED], Bil Kleb [EMAIL PROTECTED] wrote: The parensless calls also allow one to write beautiful DSLs with Ruby. What's a DSL? -- http://mail.python.org/mailman/listinfo/python-list

Re: processing the genetic code with python?

2006-03-06 Thread Roy Smith
In article [EMAIL PROTECTED], nuttydevil [EMAIL PROTECTED] wrote: I have many notepad documents that all contain long chunks of genetic code. They look something like this: atggctaaactgaccaagcgcatgcgtgttatccgcgagaaagttgatgcaaccaaacag tacgacatcaacgaagctatcgcactgctgaaagagctggcgactgctaaattcgtagaa

Re: Checking function calls

2006-03-07 Thread Roy Smith
Fredrik Tolf python-list@python.org wrote: If I have a variable which points to a function, can I check if certain argument list matches what the function wants before or when calling it? Currently, I'm trying to catch a TypeError when calling the function (since that is what is raised when

Re: Learning different languages

2006-03-07 Thread Roy Smith
Rich [EMAIL PROTECTED] wrote: Anyway, my question is: what experience you people have with working with different languages at the same time? At one point, I was working with Perl, Python, Tcl, and C++ all more or less at the same time. I just kept crib sheets handy, so I could look up

Re: Type Hinting vs Type Checking and Preconditions

2006-03-07 Thread Roy Smith
In article [EMAIL PROTECTED], Tom Bradford [EMAIL PROTECTED] wrote: Here is what I mean. The following function, though conventionally indicating that it will perform a multiplication, will yield standard Python behaviors if a string value is passed to it: def multiplyByTwo(value):

Re: New python.org website

2006-03-08 Thread Roy Smith
The first two links on the News and Announcements are dead -- they get you a 404 File Not Found. I've opened a critical ticket on this in the bug tracker. I see there's another ticket open already on a similar issue. My recommendation would be that if these can't be resolved in very short

Re: why no block comments in Python?

2006-03-08 Thread Roy Smith
Fredrik Lundh [EMAIL PROTECTED] wrote: you can quickly comment out regions by putting them inside a triple-quoted string.) Except that triple-quotes don't nest. I do agree, however, with the idea that any decent editor should be able to comment out a block of code faster than I can type this

Re: why no block comments in Python?

2006-03-08 Thread Roy Smith
Warby [EMAIL PROTECTED] wrote: Eliminating block comments eliminates uncertainty. :) An even better way to eliminate uncertainty is to eliminate the code. Commenting out is fine for a quick test during development. Once the code is committed, the dead code should be eliminated completely. --

Re: is there any overheard with try/except statements?

2006-03-08 Thread Roy Smith
In article [EMAIL PROTECTED], John Salerno [EMAIL PROTECTED] wrote: One of the things I learned with C# is that it's always better to handle any errors that might occur within the codes itself (i.e. using if statements, etc. to catch potential out of range indexing) rather than use too

Re: why no block comments in Python?

2006-03-09 Thread Roy Smith
msoulier [EMAIL PROTECTED] wrote: (and if you don't, you can quickly comment out regions by putting them inside a triple-quoted string.) Although that will use up memory, as opposed to a comment. I can't imagine a realistic scenario where the amount of memory wasted by triple-quoting out code

Re: New python.org website

2006-03-09 Thread Roy Smith
msoulier [EMAIL PROTECTED] wrote: I don't mind the logo or the colour scheme, but I do mind the first paragraph in bolded text. What, you figure the readers can't figure out how to find What is Python? by themselves? Bold should be used sparingly. This is serious overuse. I'm OK with bold for

Re: Best way to have a for-loop index?

2006-03-09 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: I write a lot of code that looks like this: for myElement, elementIndex in zip( elementList, range(len(elementList))): print myElement , myElement, at index: ,elementIndex My question is, is there a better, cleaner, or easier

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Roy Smith
Dmitry Anikin [EMAIL PROTECTED] wrote: There are often situations when a function has independent parameters, all having reasonable defaults, and I want to provide just several of them. In fact, I can do it using keyword parameters, but it's rather long and you have to remember/lookup names

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Roy Smith
In article [EMAIL PROTECTED], Antoon Pardon [EMAIL PROTECTED] wrote: Op 2006-03-10, Roy Smith schreef [EMAIL PROTECTED]: Dmitry Anikin [EMAIL PROTECTED] wrote: There are often situations when a function has independent parameters, all having reasonable defaults, and I want to provide

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Roy Smith
Antoon Pardon [EMAIL PROTECTED] wrote: Do you have trouble remembering that range(n) is actually providing the second parameter to the function and what it does? Yes. I don't use range() everyday, and it's very rare that I use more than one argument. I do remember that there are additional

Re: why no block comments in Python?

2006-03-11 Thread Roy Smith
In article [EMAIL PROTECTED], Jonathan Gardner [EMAIL PROTECTED] wrote: Warby wrote: ...and I forgot to mention that the output of grep and diff is far more understandable in the absence of block comments! Which is why people do this /anyway/. (Kind of makes block comments pointless,

Re: global, globals(), _global ?

2006-03-15 Thread Roy Smith
In article [EMAIL PROTECTED], robert [EMAIL PROTECTED] wrote: Using global variables in Python often raises chaos. Other languages use a clear prefix for globals. Unsing globals raises chaos in any language. They should be shunned and avoided. --

Re: Have you ever considered of mousing ambidextrously?

2006-03-18 Thread Roy Smith
WangQiang [EMAIL PROTECTED] wrote: I'm also a programmer, as working in front of computer day and day, my right hand is so tired and ached. So I tried to mouse in both hands. I find that it is really an efficient way to release pains. At first I switched the mouse buttons in windows control

Re: ipv6 validation

2006-03-18 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Hello, is there any common function for validation if string contains valid ip address(both ipv4 and ipv6)? Or does sb wrote some regular expression for this? thanks J Look at socket.inet_pton(). First check to make sure ipv6 is

Re: Have you ever considered of mousing ambidextrously?

2006-03-18 Thread Roy Smith
In article [EMAIL PROTECTED], Scott David Daniels [EMAIL PROTECTED] wrote: Roy Smith wrote: I never understood why people switch mouse buttons. I'm left handed, so I put the mouse on the left side of my keyboard. It never occurred to me to flip the buttons around. Well, I switch 'em

Re: Where can we find top-notch python developers?

2006-03-18 Thread Roy Smith
In article [EMAIL PROTECTED], Nicholas Reville [EMAIL PROTECTED] wrote: Hi, I hope this is an OK spot for this question: An even better place would be to post your position on the Python Jobs Board, http://www.python.org/community/jobs/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Where can we find top-notch python developers?

2006-03-18 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Alex Martelli) wrote: Unfortunately, I entirely understand _why_ most software development firms prefer face-to-face employees: when I found myself, back when I was a freelance consultant, alternatively working remotely for some time, and at

Re: Have you ever considered of mousing ambidextrously?

2006-03-19 Thread Roy Smith
In article [EMAIL PROTECTED], John Salerno [EMAIL PROTECTED] wrote: Roy Smith wrote: In article [EMAIL PROTECTED], Scott David Daniels [EMAIL PROTECTED] wrote: Roy Smith wrote: I never understood why people switch mouse buttons. I'm left handed, so I put the mouse on the left

Re: what's the general way of separating classes?

2006-03-20 Thread Roy Smith
John Salerno [EMAIL PROTECTED] wrote: From my brief experience with C#, I learned that it was pretty standard practice to put each class in a separate file. I assume this is a benefit of a compiled language that the files can then be grouped together. What I'm wondering is how is this

Re: Remote teamwork anecdotes

2006-03-20 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Alex Martelli) wrote: And even if I'm wrong, and a Joe Supercoder I've never met works best with 3 days a week of solo effort, 3 days of solo coding plus 2 of strong in-person interaction is NOT the same thing as, say, 3 _weeks_ of solo coding

Re: Difference between 'is' and '=='

2006-03-27 Thread Roy Smith
In article [EMAIL PROTECTED], Joel Hedlund [EMAIL PROTECTED] wrote: Which means that is comparisons in general will be faster than == comparisons. I thought that == automatically compared identify before trying to compare the values. Or am I thinking of some special case, like strings? --

Re: doctest, unittest, or if __name__='__main__'

2006-03-28 Thread Roy Smith
In article [EMAIL PROTECTED], Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] writes: I have noticed some distinctly funny and confused feelings I get when using the unittest module, stuff that feels clunky and odd about how it is set-up, however I thought

Re: Python 2.5 licensing: stop this change

2006-04-01 Thread Roy Smith
In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: As the only director of the Python Software Foundation to vote against a recent Board motion to implement the change in licensing terms described in http://pyfound.blogspot.com/2006/04/python-25-licensing-change.html

Scatter/gather on sockets?

2006-04-01 Thread Roy Smith
I've got a bunch of strings in a list: vector = [] vector.append (foo) vector.append (bar) vector.append (baz) I want to send all of them out a socket in a single send() call, so they end up in a single packet (assuming the MTU is large enough). I can do: mySocket.send (.join (vector)) but

Re: Scatter/gather on sockets?

2006-04-01 Thread Roy Smith
Peter Hansen [EMAIL PROTECTED] wrote: B. Don't bother trying, because even if the MTU is large enough there is absolutely no guarantee that the packet will stay intact all the way through the network anyway (even if you use sendall() instead of send()). This is true, but I'm generating the

Re: Scatter/gather on sockets?

2006-04-01 Thread Roy Smith
In article [EMAIL PROTECTED], Anthony Greene [EMAIL PROTECTED] wrote: On Sat, 01 Apr 2006 14:56:02 -0500, Roy Smith wrote: I've got a bunch of strings in a list: vector = [] vector.append (foo) vector.append (bar) vector.append (baz) I want to send all of them out a socket

Re: Difference between 'is' and '=='

2006-04-03 Thread Roy Smith
Adam DePrince [EMAIL PROTECTED] wrote: It just happens that the logical operation (a is b ) - (a == b ) is always True. Only for small values of always. You can always do pathological things with operators: class Foo: def __eq__ (self, other): return False f = Foo() print f

Re: Strange problem when running python code

2006-04-04 Thread Roy Smith
ishtar2020 [EMAIL PROTECTED] wrote: I've been writing my very first application in Python and everything is running smoothly, except for a strange problem that pops up every once in a while. I'm sure is the kind of newbie thing every seasoned programmer knows. Nobody here has a crystal ball.

Re: ``pickling'' and ``unpickling''

2006-04-06 Thread Roy Smith
In article [EMAIL PROTECTED], Lonnie Princehouse [EMAIL PROTECTED] wrote: Pickling is the Python term for serialization. See http://en.wikipedia.org/wiki/Serialization Suppose you want to save a Python object x to a file... output_file = open('my_pickle', 'wb') # open a file import

Re: Decorators, Identity functions and execution...

2006-04-09 Thread Roy Smith
Steven D'Aprano [EMAIL PROTECTED] wrote: On Sun, 09 Apr 2006 08:52:18 -0700, Carl Banks wrote: it's more important to respect community standards than to stick to some silly preference you have. What happens when the community standard is a silly preference? I object to the

Re: how relevant is C today?

2006-04-09 Thread Roy Smith
In article [EMAIL PROTECTED], gregarican [EMAIL PROTECTED] wrote: Here are a few languages I recommend most programmers should at least have a peek at: 1) Smalltalk - The original object oriented programming language. Influenced anything from Mac/Windows GUI to Java language. Terse, clean

Re: About classes and OOP in Python

2006-04-10 Thread Roy Smith
fyhuang [EMAIL PROTECTED] wrote: I've been wondering a lot about why Python handles classes and OOP the way it does. From what I understand, there is no concept of class encapsulation in Python, i.e. no such thing as a private variable. Any part of the code is allowed access to any variable in

Re: New Karrigel page in Wikipedia

2006-04-13 Thread Roy Smith
In article [EMAIL PROTECTED], Pierre Quentel [EMAIL PROTECTED] wrote: I added an entry in Wikipedia for information, just like other Python web frameworks have already done. If the style doesn't fit Wikipedia's I'm sorry and willing to learn how to improve it ; the reason I read was Obvious,

Re: Ancient projectiles (was: Muzzle Velocity (was: High resolution sleep (Linux))

2007-05-26 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Cameron Laird) wrote: Hmmm; now you've got me curious. What *were* the first composite projectiles? Fetchez la Vache! -- http://mail.python.org/mailman/listinfo/python-list

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-27 Thread Roy Smith
Ben Finney [EMAIL PROTECTED] wrote: Is C no longer a major language? The long-standing convention there is for lower_case_with_underscores. Which dates back to the days of ASR-33's which only had one case (upper case, as a matter of fact). Does nobody else remember C compilers which accepted

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-28 Thread Roy Smith
In article [EMAIL PROTECTED], Steven Bethard [EMAIL PROTECTED] wrote: Stefan Sonnenberg-Carstens wrote: Paul McGuire schrieb: I'm starting a new thread for this topic, so as not to hijack the one started by Steve Howell's excellent post titled ten small Python programs. In that

Re: Is PEP-8 a Code or More of a Guideline?

2007-05-30 Thread Roy Smith
Dave Hansen [EMAIL PROTECTED] wrote: On May 27, 3:25 pm, Roy Smith [EMAIL PROTECTED] wrote: Ben Finney [EMAIL PROTECTED] wrote: Is C no longer a major language? The long-standing convention there is for lower_case_with_underscores. Which dates back to the days of ASR-33's which only

Re: Python Pop Quiz

2007-06-01 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: 1. Do you like Python? Yes 2. Do you think Python is good? Yes 3. Do you think Python is real good? Yes 4. What is your favorite version of Python? Whichever version it was that added string methods. 5. Because of Python, do you

Re: Python Pop Quiz

2007-06-02 Thread Roy Smith
In article [EMAIL PROTECTED], Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: In [EMAIL PROTECTED], Roy Smith wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: 7. How many Z80 assembly language programmers does it take to equal one Python guru? Trick question

Re: Is 1 large Regex faster than 3 smaller ones?

2007-06-03 Thread Roy Smith
In article [EMAIL PROTECTED], erikcw [EMAIL PROTECTED] wrote: Hi, I need to match 3 small strings in a small text file (about 200 words of text). Would it be faster to write 1 compiled regex that matches all 3 substrings in one go, or to use 3 separate regular expressions to do the

Embedding unit tests in source files?

2007-06-17 Thread Roy Smith
I'm starting a new project and am thinking of embedding my unit tests right in the source files. I've used unittest before, and I'm happy with it, but I've always used it with the source code in one file and the unit tests in another. I figure if I just put a if __name__ == '__main__:

Re: strip() 2.4.4

2007-06-21 Thread Roy Smith
In article [EMAIL PROTECTED], Nick [EMAIL PROTECTED] wrote: strip() isn't working as i expect, am i doing something wrong - Sample data in file in.txt: 'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan' 'AL':'ALB':'008':'ALBANIA':'Albania' 'DZ':'DZA':'012':'ALGERIA':'Algeria'

Re: The Modernization of Emacs

2007-06-21 Thread Roy Smith
In article [EMAIL PROTECTED], David Kastrup [EMAIL PROTECTED] wrote: Kaldrenon [EMAIL PROTECTED] writes: I'm very, very new to emacs. I used it a little this past year in college, but I didn't try at all to delve into its features. I'm starting that process now, and frankly, the thought

Re: Proposed new PEP: print to expand generators

2006-06-03 Thread Roy Smith
In article [EMAIL PROTECTED], James J. Besemer [EMAIL PROTECTED] wrote: I propose that we extend the semantics of print such that if the object to be printed is a generator then print would iterate over the resulting sequence of sub-objects and recursively print each of the items in order.

Re: Dictionary .keys() and .values() should return a set [with Python 3000 in mind]

2006-07-01 Thread Roy Smith
Nick Vatamaniuc [EMAIL PROTECTED] wrote: But there is a side note: old code that assumed a particular ordering of the keys or values is broken anyway. From a testing point of view, it would be interesting if there was a flag which said, Deliberately change everything which isn't guaranteed

Re: How to check if the connectivity is via Ethernet or dial-up

2006-07-08 Thread Roy Smith
In article [EMAIL PROTECTED], jb [EMAIL PROTECTED] wrote: Hi all: I was just wondering if there is a way to check (using python scripting) whether the computer's connectivity is via Dial-up or LAN/Ethernet adaptor? Is there a way in python to check the status of all available Ethernet

Re: Best command for running shell command

2006-07-11 Thread Roy Smith
In article [EMAIL PROTECTED], Donald Duck [EMAIL PROTECTED] wrote: I'm a little bit confused about what is the best way to run a shell command, if I want to run a command like xx -a -b yy where I'm not interested in the output, I only want to make sure

Re: SNMP agent

2007-04-06 Thread Roy Smith
[EMAIL PROTECTED] (Cameron Laird) wrote: I understand the sentiment; in principle, it shouldn't be hard to write a library which supports construction of SNMP agents in Python. I'm aware of no one who has done so publicly, though. I've used pysnmp (http://pysnmp.sourceforge.net/) in a test

Re: How to check if a string is empty in python?

2007-05-02 Thread Roy Smith
In article [EMAIL PROTECTED], Dustan [EMAIL PROTECTED] wrote: On May 2, 5:50 pm, Steven D'Aprano [EMAIL PROTECTED] wrote: On Wed, 02 May 2007 13:35:47 -0700, noagbodjivictor wrote: How to check if a string is empty in python? if(s == ) ?? In no particular order, all of these

Re: How to check if a string is empty in python?

2007-05-03 Thread Roy Smith
In article [EMAIL PROTECTED], Ant [EMAIL PROTECTED] wrote: On May 3, 5:59 am, [EMAIL PROTECTED] (Alex Martelli) wrote: Steven D'Aprano [EMAIL PROTECTED] wrote: On Wed, 02 May 2007 21:19:54 -0400, Roy Smith wrote: for c in s: raise it's not empty String exceptions

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread Roy Smith
Guido sez: __slots__ is a terrible hack with nasty, hard-to-fathom side effects that should only be used by programmers at grandmaster and wizard levels. Unfortunately it has gained an enormous undeserved popularity amongst the novices and apprentices, who should know

Re: How to find difference in years between two dates?

2006-07-26 Thread Roy Smith
thebjorn [EMAIL PROTECTED] wrote: def age(born): now = date.today() birthday = date(now.year, born.month, born.day) return now.year - born.year - (birthday now and 1 or 0) I don't get that last line. There's two things in particular that are puzzling me. 1) What does

Re: Railroad track syntax diagrams

2006-08-01 Thread Roy Smith
Paul McGuire [EMAIL PROTECTED] wrote: For those who are not familiar with railroad syntax diagrams, they show a grammar's syntax using arrows and blocks, instead of BNF I've always liked railroad diagrams. Oracle used to use them (maybe they still do?) in their SQL reference manuals. I find

<    1   2   3   4   5   6   7   8   9   10   >