Re: Homework help

2008-04-01 Thread Dave Hansen
On Apr 1, 11:29 am, [EMAIL PROTECTED] wrote: > On Apr 1, 12:17 pm, Paul Rubin wrote: > > > [EMAIL PROTECTED] writes: > > > I don't necessarily want the answers, but need help on how to approach > > > it/the steps i need to solve the problems > > > What parts are you havin

Re: Order in which modules are imported

2008-02-22 Thread Dave Hansen
On Feb 22, 5:21 pm, [EMAIL PROTECTED] wrote: > I imported two modules (random and matplotlib), and found that the > functions available to me from the random module depended on the order > in which the imports occured. In particular, if I import random first, [...] > > >>> import random > >>> from

Re: Finding overlapping times...

2007-12-13 Thread Dave Hansen
On Dec 13, 5:45 pm, Breal <[EMAIL PROTECTED]> wrote: > I have a list that looks like the following > [(10, 100010), (15, 17), (19, 100015)] > > I would like to be able to determine which of these overlap each > other. So, in this case, tuple 1 overlaps with tuples 2 and 3. Tuple >

Re: newbie: self.member syntax seems /really/ annoying

2007-09-12 Thread Dave Hansen
On Sep 12, 5:21 am, Charles Fox <[EMAIL PROTECTED]> wrote: > I've just started playing around with Python, as a possible > replacement for a mix of C++, Matlab and Lisp. The language looks > lovely and clean with one huge exception: I do a lot of numerical > modeling, so I deal with objects (like

Re: Car-ac-systems

2007-09-11 Thread Dave Hansen
On Sep 11, 12:42 pm, Zentrader <[EMAIL PROTECTED]> wrote: > > What is it about "please do not top-post" that you have difficulty > understanding? Or do "MVP"s feel that their time is so much more > valuable than anyone else's that they are free to ignore the norms? > > Who made this the norm? htt

Re: Newbee Question

2007-08-21 Thread Dave Hansen
On Aug 21, 2:57 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: [...] > > pay = min(num, 22) * 0.4 + max(num-22, 0) * 1.4 pay = num*0.4 + (num>22)*(num-22) ;-) -=Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: regexp problem in Python

2007-08-03 Thread Dave Hansen
On Aug 3, 4:41 pm, Ehsan <[EMAIL PROTECTED]> wrote: > I want to find "http://www.2shared.com/download/1716611/e2000f22/ [...] > I use this pattern : > "http.*?\.(wmv|3gp).*"" > > but it returns only 'wmv' and '3gp' instead of "http://www.2shared.com/ > download/1716611/e2000f22/Jadeed_Mlak14.wmv? >

Re: The Modernization of Emacs

2007-06-21 Thread Dave Hansen
On Jun 21, 9:49 am, Robert Uhl <[EMAIL PROTECTED]> wrote: > Twisted <[EMAIL PROTECTED]> writes: > > > Given that in its out-of-the-box configuration it's well-nigh unusable > > without a printed-out "cheat sheet" of some kind, of the sort that > > were supposed to have died out in the 80s, getting

Re: The Modernization of Emacs

2007-06-20 Thread Dave Hansen
On Jun 20, 8:28 am, David Kastrup <[EMAIL PROTECTED]> wrote: > Actually, the "E" in "Emacs" stands for "extensible". Part of the > appeal of Emacs is that you can change it to accommodate you. Actually, though Emacs is the epitome of extensibility, the "E" stands for "Editor." "EMACS" is simply

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

2007-05-30 Thread Dave Hansen
Apologies for jumping into the thread late. 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'

Re: Suggestions for how to approach this problem?

2007-05-08 Thread Dave Hansen
On May 8, 3:00 pm, John Salerno <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch wrote: > > I think I have vague idea how the input looks like, but it would be > > helpful if you show some example input and wanted output. > > Good idea. Here's what it looks like now: > > 1. Levy, S.B. (1964)

Re: Mastering Python

2007-03-16 Thread Dave Hansen
On Mar 16, 8:39 am, "Paul McGuire" <[EMAIL PROTECTED]> wrote: [...] > Stop thinking about *how* to start and *just start*. Python is pretty Indeed. Of all the fortune cookies I've eaten over the years, I've saved (and taped to my monitor) only one fortune. It reads: Begin...the rest is easy.

Re: Isn't there a better way?

2006-07-22 Thread Dave Hansen
On 21 Jul 2006 07:51:15 -0700 in comp.lang.python, "T" <[EMAIL PROTECTED]> wrote: > >I am using an optparse to get command line options, and then pass them >to an instance of another class: > > > ># Class that uses optparse.OptionParser >foo = Parse_Option() > ># Class that does the real work >bar

Re: Coding style

2006-07-17 Thread Dave Hansen
On Mon, 17 Jul 2006 17:09:32 +0100 in comp.lang.python, "Simon Brunning" <[EMAIL PROTECTED]> wrote: [...] > >lst = [1,2,3,4,5] >while lst: >lst.pop() > >Or even just: > >lst = [] > del lst[:] is probably closer to what the OP wants... Regards, -=Dave

Re: stderr, stdout, and errno 24

2006-07-12 Thread Dave Hansen
On 12 Jul 2006 18:09:42 -0700 in comp.lang.python, "Wesley Henwood" <[EMAIL PROTECTED]> wrote: >To capture output from python scripts run from a C++ app I've added the >following code at the beggening of the C++ app: > >PyRun_SimpleString("import grabber"); >PyRun_SimpleString("import sys"); >PyRu

Re: Restricted Access

2006-07-11 Thread Dave Hansen
On 11 Jul 2006 10:19:22 -0700 in comp.lang.python, Paul Rubin wrote: >"K.S.Sreeram" <[EMAIL PROTECTED]> writes: >> Java is not the only restricted execution environment around. >> Javascript, as implemented by most browsers, is an excellent lightweight >> restricted exec

Re: a good programming text editor (not IDE)

2006-06-15 Thread Dave Hansen
On Thu, 15 Jun 2006 17:12:26 GMT in comp.lang.python, John Salerno <[EMAIL PROTECTED]> wrote: >I know there's a request for a good IDE at least once a week on the ng, >but hopefully this question is a little different. I'm looking for >suggestions for a good cross-platform text editor (which the

Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)

2006-05-19 Thread Dave Hansen
On 19 May 2006 07:18:03 GMT in comp.lang.python, Duncan Booth <[EMAIL PROTECTED]> wrote: [...] >My experience of programming with either spaces or tabs has taught me >that tabs are evil not for themselves, but simply because no matter how >hard you try they always end up being mixed with spaces.

Re: Sorting of list containing tuples

2006-05-18 Thread Dave Hansen
On Thu, 18 May 2006 21:29:59 +0200 in comp.lang.python, Ronny Mandal <[EMAIL PROTECTED]> wrote: >Hi! > >Assume we have a list l, containing tuples t1,t2... > >i.e. l = [(2,3),(3,2),(6,5)] > >And now I want to sort l reverse by the second element in the tuple, >i.e the result should ideally be: > >

Re: Tabs versus Spaces in Source Code ('semantic' vs. arbitrary indentation)

2006-05-17 Thread Dave Hansen
On 17 May 2006 16:13:54 -0700 in comp.lang.python, "achates" <[EMAIL PROTECTED]> wrote: >Carl J. Van Arsdall wrote: > >> The converse can also be said, "it's difficult to make sure everyone >> uses spaces and not tabs". >> >> I think we've just about beat this discussion to death... nice work >> e

Re: Tabs versus Spaces in Source Code ('semantic' vs. arbitrary indentation)

2006-05-17 Thread Dave Hansen
On Wed, 17 May 2006 12:02:46 -0700 in comp.lang.python, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >Andy Sy wrote: >> Carl J. Van Arsdall wrote: >> >> Next major objection then, how can one practically use 'tabs as semantic indentation' without screwing up formatting of code lik

Re: Tabs are EVIL *and* STUPID, end of discussion. (Re: Tabs versus Spaces in Source Code)

2006-05-17 Thread Dave Hansen
On Wed, 17 May 2006 17:28:26 GMT in comp.lang.python, Edward Elliott <[EMAIL PROTECTED]> wrote: >Sybren Stuvel wrote: > >> Andy Sy enlightened us with: >>> Like I said, you'll *NEVER* get that fancy shmancy 'semantic >>> indentation' idea to work properly in the most basic utilities which >>> have

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread Dave Hansen
On Wed, 10 May 2006 15:50:38 GMT in comp.lang.python, John Salerno <[EMAIL PROTECTED]> wrote: >Dave Hansen wrote: > >>>>> print textwrap.dedent(s).strip().replace('\n',' ') >> this is a multiline triple-quted string with indentation for nice

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread Dave Hansen
On Wed, 10 May 2006 13:56:52 GMT in comp.lang.python, John Salerno <[EMAIL PROTECTED]> wrote: >bruno at modulix wrote: > >> Why not trying by yourself ?-) > >Doh! I always forget I can do this! :) > > >> Mmm. Not good. Let's try again: > print textwrap.dedent(s).strip() >> this is a multiline

Re: Python's regular expression?

2006-05-10 Thread Dave Hansen
On Wed, 10 May 2006 06:44:27 GMT in comp.lang.python, Edward Elliott <[EMAIL PROTECTED]> wrote: > >Would I recommend perl for readable, maintainable code? No, not when better >options like Python are available. But it can be done with some effort. I'm reminded of a comment made a few years ago

Re: Tuple assignment and generators?

2006-05-05 Thread Dave Hansen
On 5 May 2006 05:23:24 -0700 in comp.lang.python, "vdrab" <[EMAIL PROTECTED]> wrote: >> Are you telling us that you *had* read that doc, >> and tripped because it says "depending on the implementation", >> when it should say "at the choice of the implementation" ? > >no. >let's see, where to start

Re: simultaneous assignment

2006-05-04 Thread Dave Hansen
On Tue, 02 May 2006 18:52:48 GMT in comp.lang.python, John Salerno <[EMAIL PROTECTED]> wrote: [...] > >Yeah, after trying some crazy things, I just wrote it this way: > >def truth_test(seq): > truth = 0 > for item in seq: > if item: > truth += 1 > if truth == 1: >

Re: do while loop

2006-04-26 Thread Dave Hansen
On Wed, 26 Apr 2006 22:41:04 +0200 in comp.lang.python, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >In <[EMAIL PROTECTED]>, ? wrote: > >> suggest add do while loop in later version > >Please also suggest a clean syntax for this. :-) > while 1: do_loop_stuff() if time_to_leave():

Re: A defense for bracket-less code

2006-04-26 Thread Dave Hansen
On Wed, 26 Apr 2006 10:20:57 -0400 in comp.lang.python, Don Taylor <[EMAIL PROTECTED]> wrote: >Found in a style guide (http://www.artlogic.com/careers/styleguide.html) >--- >Another case where "unnecessary" braces should be used i

Re: how to append to a list twice?

2006-04-21 Thread Dave Hansen
On 21 Apr 2006 12:50:38 -0700 in comp.lang.python, [EMAIL PROTECTED] wrote: >I don't get it (the Elliot solution)... How is it that the first value >is repeated once times, and the remaining values are repeated twice >times? Integer division truncates. 200/2 -> 100, 199/2 -> 99, 198/2 -> 99, etc

Re: How do you guys print out a binary tree?

2006-04-19 Thread Dave Hansen
On Tue, 18 Apr 2006 08:17:22 -0700 (PDT) in comp.lang.python, Anthony Liu <[EMAIL PROTECTED]> wrote: > > >--- bayerj <[EMAIL PROTECTED]> wrote: > >> Hi, >> >> > 1 2 3 4 5 >> > 0 7 8 9 10 >> > 0 0 13 14 15 >> > 0 0 0 19 20 >> > 0 0 0 0 25 >> > Look at the trian

Re: converting lists to strings to lists

2006-04-12 Thread Dave Hansen
On 12 Apr 2006 06:53:23 -0700 in comp.lang.python, "robin" <[EMAIL PROTECTED]> wrote: >hi, > >i'm doing some udp stuff and receive strings of the form '0.87 >0.25 0.79;\n' >what i'd need though is a list of the form [0.87 0.25 0.79] >i got to the [0:-3] part to obtain a str

Re: Decorators, Identity functions and execution...

2006-04-12 Thread Dave Hansen
On Wed, 12 Apr 2006 17:19:25 +1200 in comp.lang.python, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: >In article <[EMAIL PROTECTED]>, > "Terry Reedy" <[EMAIL PROTECTED]> wrote: > >>"Sybren Stuvel" <[EMAIL PROTECTED]> wrote in >> > I don't care about how people see my tabs. I use one tab for ever

Re: Filters like old skool Jive, Fudd, Valspeak... Text transformation in Python

2006-04-05 Thread Dave Hansen
On 5 Apr 2006 13:44:48 -0700 in comp.lang.python, [EMAIL PROTECTED] wrote: >bruno at modulix wrote: >> There's a Kant generator example in Dive Into Python: >> http://diveintopython.org/xml_processing/index.html > >Thanks Bruno! Perhaps I could modify it to throw in some Hume and >Wittgenstein, mi

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

2006-04-03 Thread Dave Hansen
On 3 Apr 2006 10:37:11 -0400 in comp.lang.python, [EMAIL PROTECTED] (Roy Smith) wrote: >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 pathologic

Re: [CODE] - Python Newcomer Starting with Coding

2006-03-21 Thread Dave Hansen
On Tue, 21 Mar 2006 20:05:48 +0200 in comp.lang.python, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: >bruno at modulix wrote: [...] >> Look for the Python cookbook (google is your friend). >... > >http://www.oreilly.com/catalog/pythoncook/ > >sorry, I've not clarified that I mean an free internet re

Re: Function params with **? what do these mean?

2006-03-20 Thread Dave Hansen
On 20 Mar 2006 15:45:36 -0800 in comp.lang.python, [EMAIL PROTECTED] (Aahz) wrote: >In article <[EMAIL PROTECTED]>, >Dave Hansen <[EMAIL PROTECTED]> wrote: [...] >>It's harder to explain than understand. Try playing with the >>following function in the pytho

Re: Function params with **? what do these mean?

2006-03-20 Thread Dave Hansen
On 20 Mar 2006 12:46:43 -0800 in comp.lang.python, "J Rice" <[EMAIL PROTECTED]> wrote: >I'm sorry for such a basic question, but I haven't been able to phrase >a search that gets me an answer and my books are totally silent on >this. I have seen a number of python function defs that take >paramet

Re: How would you open this file?

2006-02-23 Thread Dave Hansen
On Thu, 23 Feb 2006 18:01:32 -0500 in comp.lang.python, Kent Johnson <[EMAIL PROTECTED]> wrote: [...] > >filename = open_file() > >By the way 'filename' is a pretty bad name, since it contains a file >object, not a string. Maybe call it f instead. ('file' is also a bad >name because it is the na

Re: A C-like if statement

2006-02-23 Thread Dave Hansen
On Thu, 23 Feb 2006 12:04:38 -0700 in comp.lang.python, "Bob Greschke" <[EMAIL PROTECTED]> wrote: > >"Roy Smith" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] [...] >> try: >>i = a.find("3") >>print "It's here: ", i >> except NotFound: >>print "No 3's here" > >Nuts. I

Re: Python vs. Lisp -- please explain

2006-02-21 Thread Dave Hansen
On Tue, 21 Feb 2006 08:36:50 -0600 in comp.lang.python, "Chris Mellon" <[EMAIL PROTECTED]> wrote: [...] > >When asked to name some interpreted (or scripting) languages, they'll >name some off - perl, python, ruby, javascript, basic... > >They won't say Java. Ask them why Python is interpreted and

Re: Mutable numbers

2006-02-21 Thread Dave Hansen
On Tue, 21 Feb 2006 12:44:52 +0530 in comp.lang.python, Suresh Jeevanandam <[EMAIL PROTECTED]> wrote: ># I am new to python. > >In python all numbers are immutable. This means there is one object ( a >region in the memory ) created every time we do an numeric operation. I >hope there should have

Re: Python 3000 deat !? Is true division ever coming ?

2006-02-20 Thread Dave Hansen
Caution: bunny trail ahead. Feel free to skip this message, as it contains no useful content whatever... On Sat, 18 Feb 2006 12:09:02 +1100 in comp.lang.python, Steven D'Aprano <[EMAIL PROTECTED]> wrote: [...] > >I've never even used Matlab. But I have a calculator. (Actually I have >about half

Re: Merging two lists of data (Pythonic way)

2006-02-17 Thread Dave Hansen
On Thu, 16 Feb 2006 12:51:24 -0800 in comp.lang.python, "SMB" <[EMAIL PROTECTED]> wrote: > >"Jonathan Gardner" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> codes = map(lambda x: x[0], list1) >> for d in list2: >> if d['code'] in codes: >>d['VERIFIED'] = 1 >> >> Is this wha

Re: processing limitation in Python

2006-02-14 Thread Dave Hansen
On 14 Feb 2006 08:42:38 -0800 in comp.lang.python, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >If I un-comment any line in this program below the line where I >commented " all OK up to this point " This program locks up my >computer. Hmm. Ctrl-C gets me out just fine. In Idle, at least. >

Re: invert the order of a string

2006-02-13 Thread Dave Hansen
On Mon, 13 Feb 2006 19:03:32 + in comp.lang.python, rtilley <[EMAIL PROTECTED]> wrote: >Dave Hansen wrote: >> How about >> >> s = "some random string" >> print s >> s = s[::-1] >> print s > >That looks like Perl, but it works. Ma

Re: invert the order of a string

2006-02-13 Thread Dave Hansen
On Mon, 13 Feb 2006 18:51:11 + in comp.lang.python, rtilley <[EMAIL PROTECTED]> wrote: >s = list('some_random_string') >print s >s.reverse() >print s >s = ''.join(s) >print s > >Surely there's a better way to do this, right? How about s = "some random string" print s s = s[::-1] print s HT

Re: how do you pronounce 'tuple'?

2006-02-13 Thread Dave Hansen
On Mon, 13 Feb 2006 16:46:26 -0500 in comp.lang.python, Steve Holden <[EMAIL PROTECTED]> wrote: >Dave Hansen wrote: >> On Sun, 12 Feb 2006 23:30:25 -0500 in comp.lang.python, Steve Holden >> <[EMAIL PROTECTED]> wrote: [...] >> >>>"Tyoople",

Re: how do you pronounce 'tuple'?

2006-02-13 Thread Dave Hansen
On Mon, 13 Feb 2006 22:30:43 +0100 in comp.lang.python, Peter Maas <[EMAIL PROTECTED]> wrote: >John Salerno schrieb: >> Terry Hancock wrote: >> >>> So what's a 1-element tuple, anyway? A "mople"? "monople"? >>> It does seem like this lopsided pythonic creature (1,) ought >>> to have a name to re

Re: how do you pronounce 'tuple'?

2006-02-13 Thread Dave Hansen
On Sun, 12 Feb 2006 23:30:25 -0500 in comp.lang.python, Steve Holden <[EMAIL PROTECTED]> wrote: >John Salerno wrote: [...] > >> I know it comes from the suffix -tuple, which makes me think it's >> pronounced as 'toople', but I've seen (at m-w.com) that the first >> pronunciation option is 'tuhpl

Re: simple math question

2006-02-13 Thread Dave Hansen
On Sat, 11 Feb 2006 16:43:33 -0500 in comp.lang.python, John Salerno <[EMAIL PROTECTED]> wrote: >John Salerno wrote: >> Hi all. I'm just starting out with Python, so I'm a little slow right >> now. :) >> >> Can someone explain to me why the expression 5 / -2 evaluates to -3, >> especially consi

Re: is there a better way?

2006-02-10 Thread Dave Hansen
On Sat, 11 Feb 2006 01:37:59 +0100 in comp.lang.python, Schüle Daniel <[EMAIL PROTECTED]> wrote: >Lonnie Princehouse wrote: >> everybody is making this way more complicated than it needs to be. >> >> storage = list[:list.index(O)] > >the question is whether the old list is needed in the future or

Re: "Intro to Pyparsing" Article at ONLamp

2006-01-30 Thread Dave Hansen
On Mon, 30 Jan 2006 16:39:51 -0500 in comp.lang.python, Peter Hansen <[EMAIL PROTECTED]> wrote: >Christopher Subich wrote: >> Using English, because that's the only language I'm fluent in, consider >> the sentence: >> >> "The horse raced past the barn fell." >> >> It's just one of many "garden

Re: Using non-ascii symbols

2006-01-30 Thread Dave Hansen
On Fri, 27 Jan 2006 20:27:40 -0500 in comp.lang.python, Dan Sommers <[EMAIL PROTECTED]> wrote: >On Fri, 27 Jan 2006 22:29:20 GMT, >Neil Hodgson <[EMAIL PROTECTED]> wrote: > >> ... I'm so used to "/" for division that "÷" now looks strange. Indeed, I don't think I've used ÷ for division since abou

Re: beta.python.org content

2006-01-27 Thread Dave Hansen
On Fri, 27 Jan 2006 13:33:06 + in comp.lang.python, Steve Holden <[EMAIL PROTECTED]> wrote: >Shalabh Chaturvedi wrote: [...] > >> 2. "also available as the python-list mailing list" >> >> Add "or a google group (link)". It's not a "Google Group," it's a Usenet newsgroup. Google merely provi

Re: Using non-ascii symbols

2006-01-27 Thread Dave Hansen
On Fri, 27 Jan 2006 08:11:24 GMT in comp.lang.python, [EMAIL PROTECTED] (Bengt Richter) wrote: [...] >Maybe you would like the unambiguousness of >(+ 8 (* 6 2)) >or >6 2 * 8 + >? Well, I do like lisp and Forth, but would prefer Python to remain Python. Though it's hard to fit Python into

Re: Using non-ascii symbols

2006-01-27 Thread Dave Hansen
Just a couple half-serious responses to your comment... On Fri, 27 Jan 2006 11:05:15 +0100 in comp.lang.python, Magnus Lycka <[EMAIL PROTECTED]> wrote: >Terry Hancock wrote: >> That's interesting. I think many people in the West tend to >> imagine han/kanji characters as archaisms that will >> di

Re: beta.python.org content

2006-01-27 Thread Dave Hansen
On Thu, 26 Jan 2006 15:28:50 -0800 in comp.lang.python, James Stroud <[EMAIL PROTECTED]> wrote: >Rocco Moretti wrote: >> (Not that I like the logo, mind you...) > >Does anyone? There has to be a better logo! I thought the previous >requirement as established by the BDFL was no snakes. These are s

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Dave Hansen
On Thu, 26 Jan 2006 16:26:57 GMT in comp.lang.python, "Roger L. Cauvin" <[EMAIL PROTECTED]> wrote: >"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] [...] >> Is this what you mean? >> >> ^[^a]*(a{3})(?:[^a].*)?$ > >Close, but the pattern should allow "arbitrary seq

Re: Pulling numbers from ASCII filename not working

2006-01-26 Thread Dave Hansen
On Thu, 26 Jan 2006 06:39:20 GMT in comp.lang.python, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On 25 Jan 2006 12:42:20 -0800, "IamIan" <[EMAIL PROTECTED]> declaimed the >following in comp.lang.python: [...] >> I tried print repr(filename) and it returned the actual filename: >> 'n16w099.asc'

Re: float formatting

2006-01-25 Thread Dave Hansen
On 25 Jan 2006 11:32:27 -0800 in comp.lang.python, "Brian" <[EMAIL PROTECTED]> wrote: >Hello all, > >I am a bit stuck with a float formatting issue. What I want to do is >print a float to the screen with each line showing one more decimal >place. Here is a code snip that may explain it better: >

Re: Creating a more random int?

2006-01-25 Thread Dave Hansen
On Wed, 25 Jan 2006 15:21:43 - in comp.lang.python, Grant Edwards <[EMAIL PROTECTED]> wrote: >On 2006-01-25, Magnus Lycka <[EMAIL PROTECTED]> wrote: > >> P.S. Since I was a kid, I've heard people say: So you're born >> on new years day--how unusual. > >Well, it happens to slightly less than 1/

Re: Using non-ascii symbols

2006-01-24 Thread Dave Hansen
On Wed, 25 Jan 2006 08:26:16 +1100 in comp.lang.python, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Tue, 24 Jan 2006 10:38:56 -0600, Dave Hansen wrote: > >> The latter, IMHO. Especially variable names. Consider i vs. ì vs. í >> vs. î vs. ï vs. ... > >Agreed

Re: Using non-ascii symbols

2006-01-24 Thread Dave Hansen
On Tue, 24 Jan 2006 19:44:28 +0100 in comp.lang.python, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: >Dave Hansen wrote: >> C uses ! as a unary logical "not" operator, so != for "not equal" just >> seems to follow, um, logically. > >Conseq

Re: a 32 bit number to integer

2006-01-24 Thread Dave Hansen
On Tue, 24 Jan 2006 13:23:05 -0300 in comp.lang.python, Ricardo Quesada <[EMAIL PROTECTED]> wrote: >Hi, > > In python 2.0, this number was an integer: >0x88776655 > > but in python 2.4 it is a long (every number > 0x7fff it is a long) > >in python 2.4, is there a way to convert that numb

Re: Using non-ascii symbols

2006-01-24 Thread Dave Hansen
On Tue, 24 Jan 2006 04:09:00 +0100 in comp.lang.python, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: [...] >Once you open your mind for using non-ascii symbols, I'm sure one can >find a bunch of useful applications. Variable names could be allowed to >be non-ascii, as in XML. Think class names

Re: Using non-ascii symbols

2006-01-24 Thread Dave Hansen
On Tue, 24 Jan 2006 16:33:16 +0200 in comp.lang.python, Juho Schultz <[EMAIL PROTECTED]> wrote: [...] > >Fortran 90 allowed >, >= instead of .GT., .GE. of Fortran 77. But F90 >uses ! as comment symbol and therefore need /= instead of != for >inequality. I guess just because they wanted. However,

Re: Python code written in 1998, how to improve/change it?

2006-01-19 Thread Dave Hansen
On Fri, 20 Jan 2006 10:27:58 +1300 in comp.lang.python, Carl Cerecke <[EMAIL PROTECTED]> wrote: [...] > >Python has no goto. +1 [...] > >We want a goto. -1 Regards, -=Dave -- Change is inevitable, progress is not. -- http://mail.python.org/mailman/lis

Re: New Python.org website?

2006-01-19 Thread Dave Hansen
On Thu, 19 Jan 2006 11:58:27 -0600 in comp.lang.python, Terry Hancock <[EMAIL PROTECTED]> wrote: [...] >At worst, the cross might be a reference to "The Spanish >Inquisition", which anyone who knows anything about Python >should know is topical. Perhaps, but they wouldn't expect it... Regards,

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Dave Hansen
On Thu, 19 Jan 2006 08:06:50 +0100 in comp.lang.python, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Dave Hansen wrote: > [EMAIL PROTECTED] wrote] >> >Fuzzyman wrote: [...] >> >> In this case : >> >> >> >> a = ['some string

Re: OT: excellent book on information theory

2006-01-19 Thread Dave Hansen
On Thu, 19 Jan 2006 15:04:51 +0100 in comp.lang.python, Mikael Olofsson <[EMAIL PROTECTED]> wrote: >Terry Hancock wrote: >"Tim Peters" <[EMAIL PROTECTED]> wrote: >>> UK:Harry smiled vaguely back >>> US:Harry smiled back vaguely > >Terry Hancock wrote: >> I know you are pointing out the

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Dave Hansen
On 18 Jan 2006 08:41:00 -0800 in comp.lang.python, [EMAIL PROTECTED] wrote: > >Fuzzyman wrote: >> I'm not familiar with the C basic datatypes - I assume it has an array >> or list like object. >> >> Would it contain a sequence of poitners to the members ? In which case >> they would only be equal

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-18 Thread Dave Hansen
On Wed, 18 Jan 2006 17:03:23 +0100 in comp.lang.python, Claudio Grondi <[EMAIL PROTECTED]> wrote: [...] > > >>> a = 1L > >>> b = 1L > >>> a is b >False > >Python fails to reuse the long integer object. It would be interesting >to know why, because it seems to be strange, that in case of integers

Re: Indentation/whitespace

2006-01-17 Thread Dave Hansen
On 16 Jan 2006 20:41:24 -0800 in comp.lang.python, "thakadu" <[EMAIL PROTECTED]> wrote: >Yes, thats what you have to do. And that was my original point, you >cannot just paste and go, you have to first reformat. My heart bleeds. Regards, -=Dave -- Change

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-12 Thread Dave Hansen
On 12 Jan 2006 16:16:58 -0800 in comp.lang.python, [EMAIL PROTECTED] (Aahz) wrote: >In article <[EMAIL PROTECTED]>, >Dave Hansen <[EMAIL PROTECTED]> wrote: >> >>And, FWIW, I don't think I could convince my wife (or myself) to move >>to CullyFORNya for

Re: how do "real" python programmers work?

2006-01-12 Thread Dave Hansen
On 12 Jan 2006 12:20:50 -0800 in comp.lang.python, "bblais" <[EMAIL PROTECTED]> wrote: >Hello, > >Let me start by saying that I am coming from a background using Matlab >(or Octave), and C++. I am going to outline the basic nuts-and-bolts I generally write C code for embedded controllers. >of h

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-12 Thread Dave Hansen
On 11 Jan 2006 21:30:11 -0800 in comp.lang.python, [EMAIL PROTECTED] (Aahz) wrote: [..] > >Side note: I don't have a degree, and I interviewed at Google several >years ago. I'm about 97% certain that my lack of degree played little >role (if any) in my failure to get a job offer. Side note: I ha

Re: Indentation/whitespace

2006-01-12 Thread Dave Hansen
On Thu, 12 Jan 2006 11:56:05 +0800 in comp.lang.python, Jon Perez <[EMAIL PROTECTED]> wrote: [...] > >Although the below does work, I believe: Verified example: >>> def check_indent(n): if n==4: print "You like four spaces" elif n==3: print "I like three"

Re: How to create a script that list itself ?

2006-01-09 Thread Dave Hansen
On 9 Jan 2006 10:09:19 -0800 in comp.lang.python, "Patrick Allaire" <[EMAIL PROTECTED]> wrote: >How to create a script that list itself ? Stealing from the old C chestnut: s="s=%c%s%c;print s%%(34,s,34)";print s%(34,s,34) > >I would like to know, where is the script's code is stored once we >

Re: What is the slickest way to transpose a square list of lists (tuple of tuples)?

2006-01-09 Thread Dave Hansen
On Sun, 08 Jan 2006 14:27:55 -0500 in comp.lang.python, Gerard Brunick <[EMAIL PROTECTED]> wrote: >My way is ugly. These has to be a better way. This may not be the "slickest" way, but I needed some practice with list comprehensions (I've never really gotten used to them...) This works with lis

Re: What's wrong with this code snippet?

2006-01-05 Thread Dave Hansen
On Thu, 5 Jan 2006 01:14:43 + (UTC) in comp.lang.python, Karlo Lozovina <[EMAIL PROTECTED]> wrote: >Dave Hansen <[EMAIL PROTECTED]> wrote in >news:[EMAIL PROTECTED]: > >> I'm not sure what rn is, but it looks like a standard library >> random.Random obj

Re: What's wrong with this code snippet?

2006-01-04 Thread Dave Hansen
You've received good answers to your original question. Just a side issue... On Wed, 4 Jan 2006 22:19:27 + (UTC) in comp.lang.python, Karlo Lozovina <[EMAIL PROTECTED]> wrote: [...] >def GenerateRandomColour(): >rn.seed() >colour = rn.choice(['C', 'P', 'Z']) >retu

Re: problem adding list values

2005-12-22 Thread Dave Hansen
On Thu, 22 Dec 2005 19:43:15 GMT in comp.lang.python, "David M. Synck" <[EMAIL PROTECTED]> wrote: [...] >temp = float(raw_input("Please enter the first credit \n")) > >while temp != 0: >credlist.append(temp) >temp = float(raw_input("Please enter the next credit \n")) Here

Re: Guido at Google

2005-12-21 Thread Dave Hansen
On Wed, 21 Dec 2005 16:14:16 -0600 in comp.lang.python, Rocco Moretti <[EMAIL PROTECTED]> wrote: [...] >15 meters (150 decimeter, 1500 cm, etc ...) >590 inches >49 feet >16 yards >0.0093 miles >0.008 nautical miles >3 rods >0.075 furlongs >1800 barleycorns >147.63 hands >66 spans >33 cubits >13 el

Re: How to check if a string "is" an int?

2005-12-21 Thread Dave Hansen
On 21 Dec 2005 14:36:32 -0800 in comp.lang.python, Paul Rubin wrote: >There is a third choice which is the natural and obvious one: have the >function do what its name indicates. Return true if the arg is a >digit and false otherwise. If iterating over the whole strin

Re: How to check if a string "is" an int?

2005-12-21 Thread Dave Hansen
On Thu, 22 Dec 2005 01:41:34 +1100 in comp.lang.python, Steven D'Aprano <[EMAIL PROTECTED]> wrote: [...] >Well, let's find out, shall we? [...] >A small but consistent speed advantage to the try...except block. > >Having said all that, the speed difference are absolutely trivial, less >than 0.1 mi

Re: type error on porting outfile.write

2005-12-21 Thread Dave Hansen
On Tue, 20 Dec 2005 22:11:01 -0500 in comp.lang.python, Eric McCoy <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: >> I ported my code from the development to >> application platform, I found a "type error" >> on a fileout statement: > >> outfile.write(object.id +",") > >What is the type of o

Re: parsing engineering symbols

2005-12-21 Thread Dave Hansen
On Wed, 21 Dec 2005 19:10:21 +0530 in comp.lang.python, Suresh Jeevanandam <[EMAIL PROTECTED]> wrote: [re: SI prefixes] > >Exactly what I wanted. > >It would be nice if the standard float function takes care of these. No, it wouldn't. Regards, -=Dave --

Re: How to create linked list automatically

2005-12-19 Thread Dave Hansen
On Mon, 19 Dec 2005 20:51:39 + in comp.lang.python, Simon Brunning <[EMAIL PROTECTED]> wrote: >I haven't the time (or inclination) to sort out all your problems >here, but one thing jumps out at me: > >On 12/19/05, Shahriar Shamil Uulu <[EMAIL PROTECTED]> wrote: >> class Node: >> def __ini

Re: Tuples

2005-12-15 Thread Dave Hansen
On 15 Dec 2005 09:19:37 -0800 in comp.lang.python, "Tuvas" <[EMAIL PROTECTED]> wrote: >Let's say I make a program something like follows: > >x=[] >x.append([1,2,3]) >x.append([4,5,6]) >print x >print x[0] >print x[0][1] >x[0][1]=5 > >Okay, everything works here as expected except the last line. Wh

Re: Why and how "there is only one way to do something"?

2005-12-15 Thread Dave Hansen
On Thu, 15 Dec 2005 14:57:18 + in comp.lang.python, Steve Holden <[EMAIL PROTECTED]> wrote: [...] >Would you say > > do: > suite > while condition > >or what? Basically do ... while and do ... until most naturally put the Works for me, though I wouldn't cry if the "while" was

Re: ?: in Python

2005-12-15 Thread Dave Hansen
On Wed, 14 Dec 2005 21:16:23 +0100 in comp.lang.python, Lawrence Oluyede <[EMAIL PROTECTED]> wrote: >Il 2005-12-14, Andy Leszczynski <[EMAIL PROTECTED]> ha scritto: >> How can do elegantly in Python: >> >> if condition: >> a=1 >> else: >> a=2 >> >> like in C: >> >> a=condition?1:2 >> > >Th

Re: Question about tuple lengths

2005-12-14 Thread Dave Hansen
On Wed, 14 Dec 2005 12:58:16 -0500 in comp.lang.python, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: [...] > >It's the comma that makes it a tuple. The parenthesis are only required in >cases where the expression might mean something else without them. That's almost true. Consider: >>> t2 =

Re: PHP = Perl Improved

2005-12-12 Thread Dave Hansen
On Sat, 10 Dec 2005 08:25:08 GMT in comp.lang.python, Tim Roberts <[EMAIL PROTECTED]> wrote: [...] > >The design of the PHP language is not too bad, and the standard library is >extensive. It is quite possible to write well-structured, class-based web >programs with PHP. > >However, it seems that

Re: Bitching about the documentation...

2005-12-08 Thread Dave Hansen
On Wed, 07 Dec 2005 12:33:07 -0600 in comp.lang.python, Rocco Moretti <[EMAIL PROTECTED]> wrote: [...] >fred where guido had had had had had had had had had had had a better >effect on the reader I've seen this before as bill had had had but will had had had had had had or had had been correct

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-08 Thread Dave Hansen
On 8 Dec 2005 08:17:14 GMT in comp.lang.python, Antoon Pardon <[EMAIL PROTECTED]> wrote: [...] >I just think braces are the worst solution for it, as python is >concerned. Agreed. A model like Modula-2's would be much preferable, and in fact is supported (but not enforced) today (as long as you

Re: Why my modification of source file doesn't take effect when debugging?

2005-12-05 Thread Dave Hansen
On Fri, 02 Dec 2005 18:04:15 +0100 in comp.lang.python, Christophe <[EMAIL PROTECTED]> wrote: >infidel a écrit : >>>I'm using the Windows version of Python and IDLE. When I debug my .py >>>file, my modification to the .py file does not seem to take effect >>>unless I restart IDLE. Saving the file

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-02 Thread Dave Hansen
On 2 Dec 2005 10:08:21 -0800 in comp.lang.python, [EMAIL PROTECTED] wrote: >Here it is again... Python bypassed/discounted because, of all things, >scoping by indentation!?!? > >This used to surprise me. Until I hear more and more otherwise >reasonable programmers list this as their number one r

Re: Quene

2005-11-30 Thread Dave Hansen
On 30 Nov 2005 09:38:44 -0800 in comp.lang.python, "Tuvas" <[EMAIL PROTECTED]> wrote: >I am trying to write a function that holds a variable-length quene. The >quene has 2 bits of information. At some point, I would like to remove >bits of this quene, when they are completed. Is there a way to do

Re: Python as Guido Intended

2005-11-30 Thread Dave Hansen
On 30 Nov 2005 10:57:04 GMT in comp.lang.python, Antoon Pardon <[EMAIL PROTECTED]> wrote: >On 2005-11-29, Mike Meyer <[EMAIL PROTECTED]> wrote: >> Antoon Pardon <[EMAIL PROTECTED]> writes: You see, you can make languages more powerful by *removing* things from it. >>> You cast this in wa

  1   2   >