Re: Decimal Places Incorrect

2005-06-08 Thread Dan Bishop
Tom Haddon wrote: > Hi Folks, > > When I run: > > print "%0.2f" % ((16160698368/1024/1024/1024),) > > I get 15.00 > > I should be getting 15.05. Can anyone tell me why I'm not? Because you forgot to use "from __future__ import division". -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying behaviour of the != operator

2005-06-09 Thread Dan Sommers
do not claim to be an expert, but that doesn't seem very Pythonic to me. AIUI, __cmp__ exists for backwards compatibility, and __eq__ and friends are flexible enough to cover any possible comparison scheme. Why make the rules, the documentation, and the implementation even more "interesting" than they already are? Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Is pyton for me?

2005-06-09 Thread Dan Bishop
Mark de+la+Fuente wrote: > I need to write simple scripts for executing command line functions. Up till > now I've used C-Shell scripts for this, but I'm looking for a better > alternative. And I keep reading about how "easy" it is to program with > python. > > Unfortunately after reading "divein

Re: Annoying behaviour of the != operator

2005-06-10 Thread Dan Bishop
Steven D'Aprano wrote: ... > If you were to ask, "which is bigger, 1+2j or 3+4j?" then you > are asking a question about mathematical size. There is no unique answer > (although taking the absolute value must surely come close) and the > expression 1+2j > 3+4j is undefined. > > But if you ask "whic

Re: Annoying behaviour of the != operator

2005-06-10 Thread Dan Sommers
On Fri, 10 Jun 2005 09:50:56 -0500, Rocco Moretti <[EMAIL PROTECTED]> wrote: > Dan Sommers wrote: >> On Thu, 09 Jun 2005 15:50:42 +1200, >> Greg Ewing <[EMAIL PROTECTED]> wrote: >> >>> Rocco Moretti wrote: >>> >>>> The main problem

Re: case/switch statement?

2005-06-12 Thread Dan Sommers
> readability, one alternative is to use a dictionary: > case = {5: do_this, 6: do_that} > case.get(x, do_something_else)() I find this very readable. YMMV. I also find this easier to extend in the "case" (pardon the pun) that my program expands and x might now be 7 or 8 (or &

Re: How to get/set class attributes in Python

2005-06-12 Thread Dan Sommers
there's no need for my program to recheck every parameter on every function call all the way down. Either everything works, or that same UI code catches and logs a TypeError or ValueError or KeyError exception and asks the user what to do next. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

How to test if an object IS another object?

2005-06-12 Thread dan . eloff
If two objects are of equal value you can compare them with ==. What I want to do is find out if two objects are actually just references to the same object, how can I do this in Python? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: What language to manipulate text files

2005-06-12 Thread Dan Christensen
in the current folder called EATING > with a new name of *FOOD*COPY.txt Bash? for f in *FOOD*.txt; do cp ${f} EATING/${f}COPY.txt; done Or "mmv", a linux utility: mmv '*FOOD*.txt' 'EATING/#1FOOD#2COPY.txt' For the rest, I personally for choose python. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Tiff Image Reader/writer

2005-06-13 Thread Dan Sommers
On 13 Jun 2005 07:55:04 -0700, "PyPK" <[EMAIL PROTECTED]> wrote: > Hi I am looking for a simple tiff Image reader/writer in python.Can > anyone point me to the right one. I don't know what your definition of "simple" is, but check out the Python Imaging Libra

Re: string formatting using the % operator

2005-06-13 Thread Dan Sommers
x27;smith'+'%' >sql += 'WHERE name LIKE %s' % searchterm > Any Ideas? Let the DB-API do more work for you: cursor = connection.cursor( ) sql = """SELECT column2, columns3 FROM table WHERE name LIKE %s""" values

Re: Resume after exception

2005-06-14 Thread Dan Sommers
irst_line == "FILE LOCKED" and read_if_locked == FALSE: return False [read the rest] return True def open_command(): if open_file("foo.bar") == False: [ask the user what to do] if ans == tkMessageBox.YES:

Re: sudo open() ? (python newbee question)

2005-06-14 Thread Dan Sommers
kernel or filesystem bug, in which case all bets are off anyway). Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: sudo open() ? (python newbee question)

2005-06-14 Thread Dan Sommers
On Tue, 14 Jun 2005 16:18:19 +0300, Christos "TZOTZIOY" Georgiou <[EMAIL PROTECTED]> wrote: > I believe that the suid bit on scripts (either *sh or python) is > completely ignored on most *nix systems. Most *modern* systems, yes. ;-) I must be getting old. :-( Regards

Re: dynamic

2005-06-15 Thread Dan Sommers
rith from > the choosed nx class is this one. > If there is a better approach, I can implement it. class single(object): pass class n1(single): pass class n2(single): pass class n3(single): pass HTH, Dan -- Dan Sommers <http://www.tombston

Re: can this be implemented?

2007-06-02 Thread Dan Bishop
On Jun 2, 6:54 pm, greenflame <[EMAIL PROTECTED]> wrote: > First I should start with some introductory comments. > > When I first learned about programming, I started with BASIC, QBASIC > to be more accurate. While I was at that stage, I learned about the > INPUT command. I used it abundantly. > >

Re: int vs long

2007-06-02 Thread Dan Bishop
On Jun 2, 9:30 pm, jay <[EMAIL PROTECTED]> wrote: > I was reading in a book that the 'int' type can store whole numbers > up to 32 bits. I'm not exactly sure what that means, but got me > wondering, what's the largest number you can store as an 'int' before > you need to switch over to 'long'? sy

Re: int vs long

2007-06-03 Thread Dan Bishop
On Jun 2, 11:55 pm, kaens <[EMAIL PROTECTED]> wrote: > On 02 Jun 2007 20:18:02 -0700, Paul Rubin > > <"http://phr.cx"@nospam.invalid> wrote: > > Dan Bishop <[EMAIL PROTECTED]> writes: > > > Note that recent versions of Python automatically promot

Re: *Naming Conventions*

2007-06-03 Thread Dan Bishop
On Jun 3, 11:03 pm, Thorsten Kampe <[EMAIL PROTECTED]> wrote: > Okay, > > I hear you saying 'not another naming conventions thread'. I've read > through Google and the 'naming conventions' threads were rather > *spelling conventions* threads. > > I'm not interested in camelCase versus camel_case or

Re: lists - append - unique and sorted

2007-06-06 Thread Dan Bishop
On Jun 6, 10:26 am, rhXX <[EMAIL PROTECTED]> wrote: > hi, > > can i append a item to a list using criterias: > > - UNIQUE - if there already exist don't append > > and/or > > - SORTED - INSERT in the correct place using some criteria? > > tks in advance If you don't need the list to be sorted unti

Re: Integer division

2007-06-07 Thread Dan Bishop
On Jun 7, 8:30 pm, Some Other Guy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hello all, > > I have two integers and I want to divide one by another, and want to > > get an integer result which is the higher side whenever the result is > > a fraction. > > 3/2 => 1 # Usual behavior >

Re: Problem with following python code

2007-06-11 Thread Dan Hipschman
On Tue, Jun 12, 2007 at 04:25:31AM -, why? wrote: > I've been having problem with the following code. It's supposed to > print the prime numbers between 10 and 100. But i'm not getting any > output, i.e. i guess the outer 'for' loop is being traversed only > once. I would be greatful if you co

Re: matrix class

2007-06-12 Thread Dan Bishop
On Jun 12, 7:31 pm, DarrenWeber <[EMAIL PROTECTED]> wrote: > Below is a module (matrix.py) with a class to implement some basic > matrix operations on a 2D list. Some things puzzle me about the best > way to do this (please don't refer to scipy, numpy and numeric because > this is a personal progr

Re: Function that returns a tuple

2007-06-16 Thread Dan Hipschman
On Sat, Jun 16, 2007 at 06:30:26PM -0700, Marcpp wrote: > Hi, I need to returns a tuple from a function (reads a database) > Any idea?. Like this? def foo(): return 1, 2, 3, 4 -- http://mail.python.org/mailman/listinfo/python-list

convert hex to decimal - ala IBM Maniframe Assembly Language

2007-06-25 Thread Dan McGarigle
ground in 1967, (way before the 8088 existed) and has not looked back since. Thanks for accepting a rant from a stranger. Dan McGarigle ( 36 years an IBM mainframe programmer and proud of it, thank you ! ) El Segundo, CA -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I 'compound' streams?

2007-06-27 Thread Dan Bishop
On Jun 27, 7:40 pm, XiaQ <[EMAIL PROTECTED]> wrote: > I need to build a stream that writes to stdout and a file at the same > time. Is there already a function in the Python library to do this? class FileAndStdout(file): def write(self, data): file.write(self, data) sys.stdout

Re: 16bit hash

2007-06-27 Thread Dan Bishop
On Jun 27, 12:11 pm, Robin Becker <[EMAIL PROTECTED]> wrote: > Josiah Carlson wrote: > > Robin Becker wrote: > >> Is the any way to get an efficient 16bit hash in python? > > > hash(obj)&65535 > > > - Josiah > > yes I thought of that, but cannot figure out if the internal hash really > distribute

Re: Questions about input lines (maximum length and continuation)

2007-07-03 Thread Dan Bishop
On Jul 3, 10:41 pm, Robert Dodier <[EMAIL PROTECTED]> wrote: > Hello, > > I'm planning to write a program which automatically generates > Python code. > > (1) Is there a limit on the length of a line in a Python program? No. > (2) From what I understand, symbols, operators, and numbers > cannot b

Re: Where is the syntax for the dict() constructor ?!

2007-07-05 Thread Dan Bishop
On Jul 5, 10:19 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote: > > Besides, a string is an excellent epresentation for a zip code, > > since arithmetic upon them is unthinkable. > > Absolutely! Excel, unless you remedied that later with a column > operation,

Re: Learning Basics

2007-07-08 Thread Dan Bishop
On Jul 8, 12:10 pm, Brad <[EMAIL PROTECTED]> wrote: > So I've been studying python for a few months (it is my first foray > into computer programming) and decided to write my own little simple > journaling program. It's all pretty basic stuff but I decided that I'd > learn more from it if more expe

Re: Pass by reference or by value?

2007-07-13 Thread Dan Bishop
On Jul 13, 2:10 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I noticed in Python all function parameters seem to be passed by > reference. This means that when I modify the value of a variable of a > function, the value of the variable externally from the function is > also modified. Pyt

Re: Semantics of file.close()

2007-07-16 Thread Dan Bishop
On Jul 16, 6:35 pm, [EMAIL PROTECTED] wrote: > Hello, > > I'm a Python beginner and I'm trying to open, write and close a file > in a > correct manner. I've RTFM, RTFS, and I've read this > thread:http://groups.google.ca/group/comp.lang.python/browse_thread/thread/7... > > I still cannot figure ou

Re: In a dynamic language, why % operator asks user for type info?

2007-07-16 Thread Dan Bishop
On Jul 16, 7:10 pm, Karthik Gurusamy <[EMAIL PROTECTED]> wrote: > Hi, > > The string format operator, %, provides a functionality similar to the > snprintf function in C. In C, the function does not know the type of > each of the argument and hence relies on the embedded % > specifier to guide itse

Re: a=0100; print a ; 64 how to reverse this?

2007-07-17 Thread Dan Bishop
On Jul 17, 7:40 am, mosi <[EMAIL PROTECTED]> wrote: > Thank you, > this is great, > I thought that this should be standard in python 2.4 or 2.5 or in some > standard library (math ???) > Didn`t find anything. The bin() function is slated to be added to the next version of Python. Why there isn't

◙►FREE Satellite TV on your PC◄◙

2007-07-20 Thread Dan C
Watch Free Satellite TV on your PC or Laptop Instantly Turn your Computer into a Super TV • Watch all your favorite shows on your Computer & TV! • Channels you can’t get any other place in the U.S.A! • Watch from anywhere in the world! • Save 1000's of $$$ over many years on cable and satellite

Re: Permutations with generators

2007-07-20 Thread Dan Bishop
On Jul 21, 12:42 am, Pablo Torres <[EMAIL PROTECTED]> wrote: > Hey guys! > For the last couple of days, I've been fighting a war against > generators and they've beaten the crap out of me several times. What I > want to do is implement one that yields every possible permutation of > a given sequenc

indexing web pages - in python?

2007-04-18 Thread Dan Stromberg
Are there any open source search engines written in python for indexing a given collection of (internal only) html pages? Right now I'm talking about dozens, but hopefully it'll be hundreds or thousands at some point. I'm thinking some sort of CGI script, with perhaps a cron job that updates the

Re: How do I tell the difference between the end of a text file, and an empty line in a text file?

2007-05-16 Thread Dan Bishop
On May 16, 4:47 pm, walterbyrd <[EMAIL PROTECTED]> wrote: > Python's lack of an EOF character is giving me a hard time. > > I've tried: > > - > s = f.readline() > while s: > . > . > s = f.readline() > > > and > > --- > s = f.readline() > while s != '' > . > . > s = f.readline() > -

Re: A newbie question

2007-05-21 Thread Dan Bishop
On May 21, 6:04 pm, "wang frank" <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to write a python class with a new data type such as: > class Cc14: >def __init__(self, realpart, imagpart): > self.r=realart > self.i=imagpart > >def __add__(self,x):

Re: 0 == False but [] != False?

2007-05-24 Thread Dan Bishop
On May 24, 1:59 am, Tim Roberts <[EMAIL PROTECTED]> wrote: ... > False is just a constant. 0, (), '', [], and False are all constants that > happen to evaluate to a false value in a Boolean context, but they are not > all the same. > > As a general rule, I've found code like "if x == False" to be

Re: conditionally creating functions within a class?

2007-05-26 Thread Dan Bishop
On May 25, 7:44 pm, kaens <[EMAIL PROTECTED]> wrote: > So, I have a class that has to retrieve some data from either xml or > an sql database. > This isn't a problem, but I was thinking "hey, it would be cool if I > could just not define the functions for say xml if I'm using sql", so > I did some

Re: Newbie: Struggling again 'map'

2007-05-26 Thread Dan Bishop
On May 26, 4:54 am, mosscliffe <[EMAIL PROTECTED]> wrote: > I thought I had the difference between 'zip' and 'map' sorted but when > I try to fill missing entries with something other than 'None'. I do > not seem to be able to get it to work - any pointers appreciated. > > Richard > > lista = ['a1'

Re: printing list, is this a bug?

2007-05-26 Thread Dan Bishop
On May 25, 3:55 pm, William Chang <[EMAIL PROTECTED]> wrote: > Is the different behavior between __repr__ and __str__ intentional > when it comes to printing lists? Basically I want to print out a list > with elements of my own class, but when I overwrite __str__, __str__ > doesn't get called but i

Using python for a CAD program

2007-05-26 Thread Dan Fabrizio
e any suggestions or advice. Regards, Dan Fabrizio ASIC Engineer Aviom Inc. 1157 Pheonixville Pike. West Chester, Pa. 19380 Phone 610 738 9005 ext. 292 Fax 610 738 9950 -- http://mail.python.org/mailman/listinfo/python-list

Re: automatic type conversion for comparison operators

2007-07-26 Thread Dan Bishop
On Jul 26, 6:22 pm, Russ <[EMAIL PROTECTED]> wrote: > I posted a message on this several days ago, but it apparently got > lost > in googlespace, so I'll try it again. > > I recently discovered a bug in my code that apparently resulted from > the automatic conversion of a function pointer to an int

Re: question about math module notation

2007-07-26 Thread Dan Bishop
On Jul 26, 3:59 pm, Paul Rubin wrote: > brad <[EMAIL PROTECTED]> writes: > > Ah yes, that works too... thanks. I've settled on doing it this way: > > print int(math.pow(2,64)) > > I like the added parenthesis :) > > I was surprised to find that gives an exact (integer, no

Re: automatic type conversion for comparison operators

2007-07-26 Thread Dan Bishop
On Jul 26, 8:04 pm, Russ <[EMAIL PROTECTED]> wrote: > Dan Bishop wrote: > > BTW, are you a former Pascal programmer? > > No. Why do you ask? [The code snippet I wrote was made up to get a > point across. I > did not actually use that function name in my code.] I just ha

►Watch FREE Satellite TV on your PC or Laptop◄

2007-07-27 Thread Dan C
Instantly Turn your Computer into a Super TV • Watch all your favorite shows on your Computer & TV! • Channels you can’t get any other place in the U.S.A! • Watch from anywhere in the world! • Save 1000's of $$$ over many years on cable and satellite bills • INSTANT DOWNLOAD • And much, much more!

Re: Free SMS from Computer Worldwide

2007-08-01 Thread Dan Anos
Hi Lowbowman, Interested in expanding your SMS website to other countries, check out our affiliate scheme on FreebieSMS.co.uk. I cant see your email address on your website. Fiach On Jul 31, 4:09 am, lowboman <[EMAIL PROTECTED]> wrote: > Hello there I invite you to check out my siteh

Re: bias in random.normalvariate??

2007-08-03 Thread Dan Bishop
On Aug 3, 10:38 pm, [EMAIL PROTECTED] wrote: > I'm a Python newbie and certainly no expert on statistics, but my wife > was taking a statistics course this summer and to illustrate that > sampling random numbers from a distribution and taking an average of > the samples gives you a random number as

Re: beginner whitespace question

2007-08-09 Thread Dan Bishop
On Aug 9, 6:47 pm, eggie5 <[EMAIL PROTECTED]> wrote: > I keep getting an error for line 7, what's wrong with this? > > from django.db import models > > class Poll(models.Model): > question = models.CharField(max_length=200) > pub_date = models.DateTimeField('date published') > > def

Re: beginner whitespace question

2007-08-09 Thread Dan Bishop
On Aug 9, 7:02 pm, eggie5 <[EMAIL PROTECTED]> wrote: > On Aug 9, 4:52 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > > > On Aug 9, 6:47 pm, eggie5 <[EMAIL PROTECTED]> wrote: > > > > I keep getting an error for line 7, what's wrong with this? > >

Re: beginner whitespace question

2007-08-09 Thread Dan Bishop
On Aug 9, 8:28 pm, James Stroud <[EMAIL PROTECTED]> wrote: > eggie5 wrote: > > But this still isn't valid: > > > from django.db import models > > > class Poll(models.Model): > >question = models.CharField(max_length=200) > >pub_date = models.DateTimeField('date published') > > > def __u

Re: Fatest standard way to sum bytes (and their squares)?

2007-08-18 Thread Dan Stromberg
On Sun, 12 Aug 2007 02:26:59 -0700, Erik Max Francis wrote: > For a file hashing system (finding similar files, rather than identical > ones), I need to be able to efficiently and quickly sum the ordinals of > the bytes of a file and their squares. Because of the nature of the > application, i

Re: beginner, idomatic python 2

2007-08-23 Thread Dan Bishop
On Aug 23, 10:21 pm, "bambam" <[EMAIL PROTECTED]> wrote: > Would someone like to suggest a replacement for this? This is a > function that returns different kinds of similar objects, depending > on what is asked for. PSP and PWR are classes. I don't really > want to re-write the calling code very

Re: Does shuffle() produce uniform result ?

2007-08-25 Thread Dan Bishop
On Aug 24, 2:38 am, tooru honda <[EMAIL PROTECTED]> wrote: > Hi, > > I have read the source code of the built-in random module, random.py. > After also reading Wiki article on Knuth Shuffle algorithm, I wonder if > the shuffle method implemented in random.py produces results with modulo > bias. > >

Re: Biased random?

2007-08-28 Thread Dan Sommers
want to tend towards the beginning of the list, and don't care what the envelope looks like, how about this: def biasedselection(thelist): index = random.random() * random.random() * len(thelist) # or index random.random() ** 2 * len(thelist)

Re: unsigned integer?

2007-03-10 Thread Dan Bishop
On Mar 10, 11:32 am, "Jack" <[EMAIL PROTECTED]> wrote: > This is a naive question: > > "%u" % -3 > > I expect it to print 3. But it still print -3. > > Also, if I have an int, I can convert it to unsigned int in C: >int i = -3; >int ui = (unsigned int)i; > > Is there a way to do this in Pyt

Re: unsigned integer?

2007-03-10 Thread Dan Bishop
On Mar 10, 11:50 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Jack" <[EMAIL PROTECTED]> wrote: > > This is a naive question: > > > "%u" % -3 > > > I expect it to print 3. But it still print -3. > > Internally it uses the C runtime to format the number, but if the number > you ask it to print unsi

Re: Formatted Input

2007-03-10 Thread Dan Bishop
On Mar 10, 1:29 pm, "Deep" <[EMAIL PROTECTED]> wrote: > Hi all, > I am a newbie to python > I have an input of form > space > ie. > 4 3 > how can i assign these numbers to my variables?? n1, n2 = map(int, raw_input().split()) -- http://mail.python.org/mailman/listinfo/python-list

Re: Phase change material ...

2007-03-10 Thread Dan Bloomquist
be moved out on the scale of hours. The only time I could see having trouble is on the very coldest nights and having to bring the house back up to temperature in the morning. The contingency plan for that is I load the boiler with some wood in the evening and it autostarts very early in the morning for those coldest nights. Best, Dan. -- http://mail.python.org/mailman/listinfo/python-list

Re: Signed zeros: is this a bug?

2007-03-11 Thread Dan Bishop
On Mar 11, 9:31 am, "Mark Dickinson" <[EMAIL PROTECTED]> wrote: > I get the following behaviour on Python 2.5 (OS X 10.4.8 on PowerPC, > in case it's relevant.) > > >>> x, y = 0.0, -0.0 > >>> x, y > (0.0, 0.0) > >>> x, y = -0.0, 0.0 > >>> x, y > > (-0.0, -0.0) > > I would have expected y to be -0.0

Re: ANN: ActivePython 2.5.0.0 is now available

2007-03-15 Thread dan . shechter
On Mar 13, 9:56 pm, Trent Mick <[EMAIL PROTECTED]> wrote: > I'm happy to announce that ActivePython 2.5.0.0 is now available for download > from: > http://www.activestate.com/products/activepython/ > > This is the first release of ActivePython for Python version 2.5. Apologies > for the long d

Re: newb: Python Floating Point

2007-03-15 Thread Dan Bishop
On Mar 15, 6:09 pm, "johnny" <[EMAIL PROTECTED]> wrote: > When I do the following, rounding to 2 decimal places doesn't seem to > work. I should get 0.99 : In binary, 0.99 is the recurring fraction 0.11 010111101000 010111101000 010111101000 Thus, it can't be exactly

Re: TypeError: 'int' object is not callable

2007-03-22 Thread Dan Bishop
On Mar 22, 6:54 pm, [EMAIL PROTECTED] wrote: > I'm trying to test a few different approaches to displaying pages via > Cherrypy and I'm not having much luck. Here is my code so far: > > import sys, cherrypy, html > > class Root: > @cherrypy.expose > def index(self, pageid = None):

Re: Calling private base methods

2007-04-12 Thread Dan Bishop
On Apr 12, 3:02 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > "7stud" <[EMAIL PROTECTED]> wrote: > > On Apr 12, 5:04 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > >> "7stud" <[EMAIL PROTECTED]> wrote: > >> > On Apr 12, 2:47 am, "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > >> >> Is it possible to cal

Re: Simple integer comparison problem

2007-04-14 Thread Dan Bishop
On Apr 14, 10:19 am, [EMAIL PROTECTED] wrote: > Hi! > I ran in problem with simple exercise. I'm trying to get program to > return grade when given points but no matter what, I always get F. > > def grader(): > print "Insert points: " > points = raw_input('> ') > int(points) > >

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Dan Bishop
On Apr 14, 10:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > The FORTRAN family had started as 1-based (F95, and Ada, now allow > for each array to have its own "base" => x : array (-10..10) of float). > Pascal, I forget... Pascal allows arbitrary array bases. It's where Ada got t

Re: is laziness a programer's virtue?

2007-04-15 Thread Dan Bensen
more effective than repetition. -- Dan www.prairienet.org/~dsb/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-15 Thread Dan Bishop
On Apr 15, 6:06 pm, "Beliavsky" <[EMAIL PROTECTED]> wrote: > On Apr 14, 10:12 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > > > > > So the running count is: > > Ayes to the left: VB compatibility. > > Nays to the right: QuadIO, Perl, Dijkstra paper. > > > The nays have it! > > One-based indexing

Re: subclass of integers

2007-09-14 Thread Dan Bishop
On Sep 14, 9:30 am, Mark Morss <[EMAIL PROTECTED]> wrote: > I would like to construct a class that includes both the integers and > None. I desire that if x and y are elements of this class, and both > are integers, then arithmetic operations between them, such as x+y, > return the same result as

Re: A short question about non-ascii characters in list

2007-09-16 Thread Dan Bishop
On Sep 17, 12:08 am, js <[EMAIL PROTECTED]> wrote: > >>> print u"äöü" > äöü > >>> print [u"äöü"] > > [u'\xe4\xf6\xfc'] > > Python seems to treat non-ASCII chars in a list differently from the > one in the outside of a list. > I think this behavior is so inconvenient and actually makes debugging > w

Making a small change to a large XML document

2007-09-24 Thread Dan Stromberg
Say I want to take an existing XML document, and change the value="9997" and value="9998" to two different numbers, without changing any of the rest of the document - not even changing comments or indentation, if avoidable. What's the best way of doing it in python? My

Python XML API's that preserve XML comments?

2007-09-25 Thread Dan Stromberg
Are there any python XML parsing API's that preserve comments - preferrably that come with python 2.5.1? -- http://mail.python.org/mailman/listinfo/python-list

Re: notify when process finishes (on unix)

2007-09-30 Thread Dan Stromberg
On Sun, 30 Sep 2007 11:54:38 -0700, Michael Bentley wrote: > On Sep 30, 2007, at 7:11 AM, bahoo wrote: >> I'd like to write a script that sends me an email when a unix (Linux) >> process ends running (or CPU drops below some threshold). Could anyone >> point me to the relevant functions, or show

Re: A question about subprocess

2007-10-04 Thread Dan Stromberg
You don't necessarily need the subprocess module to do this, though you could use it. I've done this sort of thing in the past with fork and exec. To serialize the jobs on the machines, the easiest thing is to just send the commands all at once to a given machine, like "command1; command2; comma

Re: Really basic problem

2007-10-10 Thread Dan Stromberg
On Mon, 08 Oct 2007 12:23:27 +0200, A.T.Hofkamp wrote: > On 2007-10-08, Andreas Tawn <[EMAIL PROTECTED]> wrote: >>> i know this example is stupid and useless, but that's not the answer >>> to my question. >>> here it goes: >>> >> You've just discovered the joys of floating point number comparison

Re: Finding Peoples' Names in Files

2007-10-11 Thread Dan Stromberg
On Thu, 11 Oct 2007 11:22:50 -0400, brad wrote: > Crazy question, but has anyone attempted this or seen Python code that > does? For example, if a text file contained 'Guido' and or 'Robert' and > or 'Susan', then we should return True, otherwise return False. It'll be hard to handle the Dweezi

Re: Declarative properties

2007-10-11 Thread Dan Stromberg
On Thu, 11 Oct 2007 13:46:12 +, Marc 'BlackJack' Rintsch wrote: > On Thu, 11 Oct 2007 13:04:53 +, Artur Siekielski wrote: > >> On Oct 11, 2:27 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >>> But why? Default getters and setters are unnecessary and if you need >>> something ot

Re: "".join(string_generator()) fails to be magic

2007-10-11 Thread Dan Stromberg
On Thu, 11 Oct 2007 01:26:04 -0500, Matt Mackal wrote: > I have an application that occassionally is called upon to process > strings that are a substantial portion of the size of memory. For > various reasons, the resultant strings must fit completely in RAM. > Occassionally, I need to join some

Re: Cross-platform GUI development

2007-10-12 Thread Dan Stromberg
On Fri, 12 Oct 2007 05:30:13 -0500, Nick Craig-Wood wrote: > 3) Isn't a pain to install on windows (GTK) pygtk is easy to install on windows if you use cygwin. I started developing a little ssh GUI frontend on a windows laptop using cygwin pygtk and cygwin openssh. When I moved it over to a Li

Re: Declarative properties

2007-10-12 Thread Dan Stromberg
On Fri, 12 Oct 2007 09:42:28 +0200, Bruno Desthuilliers wrote: >>> So what? Otherwise you carry *always* the baggage of a public >>> property and a private attribute whether you need this or not. At >>> least for me it would be unnecessary in most cases. >> >> That "baggage" of carrying around

Re: Declarative properties

2007-10-12 Thread Dan Stromberg
On Thu, 11 Oct 2007 18:42:16 +, Marc 'BlackJack' Rintsch wrote: >> The "baggage" of possibly fixing (AKA "generalizing") how your attributes >> are accessed is something you lug around while your deadline looms. > > Sorry I don't get it. If I want to customize the access to a "normal" > att

Re: ACM SIGAPL / APL2007 Conference / Montreal / one week away

2007-10-21 Thread Dan Nagle
What about a unicode version of APL? > > Honestly, I cannot use J because it mixes with all > the characters I use... ;) > -Veli-Matti > > > > -- Dan Nagle Purple Sage Computing Solutions, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: delineating by comma where commas inside quotation marks don't count

2007-10-24 Thread Dan Bishop
On Oct 24, 8:56 pm, "Junior" <[EMAIL PROTECTED]> wrote: > I want to open a text file for reading and delineate it by comma. I also > want any data > surrounded by quotation marks that has a comma in it, not to count the > commas inside the > quotation marks Use the csv module. -- http://mail.py

Re: Proposal: Decimal literals in Python.

2007-10-27 Thread Dan Bishop
On Oct 27, 10:27 am, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Oct 27, 3:09 pm, MRAB <[EMAIL PROTECTED]> wrote: > > > > > On Oct 27, 12:12 am, Ben Finney <[EMAIL PROTECTED]> > > wrote:> Matimus <[EMAIL PROTECTED]> writes: > > > > The trailing L [for 'long' literals] is going away in Python 3.0. >

Re: Summarizing data by week

2007-01-09 Thread Dan Bishop
On Jan 9, 1:57 pm, "Mike Orr" <[EMAIL PROTECTED]> wrote: > What's the best way to summarize data by week? I have a set of > timestamped records, and I want a report with one row for each week in > the time period, including zero rows if there are weeks with no > activity. I was planning to use IS

Re: dot operations

2007-01-11 Thread Dan Bishop
On Jan 11, 10:21 am, "Steven W. Orr" <[EMAIL PROTECTED]> wrote: > On Thursday, Jan 11th 2007 at 11:41 +0100, quoth robert: > > =>[EMAIL PROTECTED] wrote:=>> Hi, > =>> Frequently I get to do like this: > =>> a = (1, 2, 3, 4) # some dummy values > =>> b = (4, 3, 2, 1) > =>> import operator > =>> c =

Re: Tools Designing large/complicated applications

2007-01-12 Thread Dan Sommers
sign? > Yes : coffee, beer, pizzas, cigarettes, paper napkins, pen, and a good > wiki. It is a well-known fact that the best engineering tools ever invented are the cocktail napkin and the white board. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> "I wish people

Re: Boilerplate in rich comparison methods

2007-01-13 Thread Dan Bishop
On Jan 13, 12:52 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I'm writing a class that implements rich comparisons, and I find myself > writing a lot of very similar code. If the calculation is short and > simple, I do something like this: > > class Parrot: > def __eq__(self, other): >

Re: HTML Calendar code

2007-01-13 Thread Dan Bishop
On Jan 13, 11:35 am, Kajsa Anka <[EMAIL PROTECTED]> wrote: > Before I re-invent something I would like to ask if there exists some code > that can be used for create the HTML code for a calendar which I then can > include on a web page. > > The module in the standard library can create a calendar b

Re: indentation in python

2007-01-13 Thread Dan Bishop
On Jan 13, 8:49 pm, "lee" <[EMAIL PROTECTED]> wrote: > Can anyone tell me the basics about indentation in python..how we > use it in loops and constructs..etc It's just like indentation in other languages, except that it's syntactically required. -- http://mail.python.org/mailman/listinf

Re: How can I write code using FP

2007-01-16 Thread Dan Bishop
On Jan 16, 9:18 pm, "kernel1983" <[EMAIL PROTECTED]> wrote: > In Function Program,Language can use like this: > > define a function: > f = lambda x,y:x,y > > then we use f to define another function: > f2 = f(1) > the f2 should equal to: > f2=lambda y:1,y > > we should be able call f2 with one para

Passing Python socket objects to child processes in Windows

2007-01-22 Thread dan . jakubiec
tuff. So I'm a bit stuck. Is there a better way (or any way?) to pass a socket to a child process in Windows, and to actually end up with a Python socket object in the child process? Thanks in advance for any help. -- Dan Jakubiec -- http://mail.python.org/mailman/listinfo/python-list

Re: import from future

2007-01-28 Thread Dan Bishop
On Jan 28, 1:25 am, "lee" <[EMAIL PROTECTED]> wrote: > what are the things that we can do with import from future usage.i > heard its very interesting..thanks Now that nested_scopes and generators are no longer optional, the only thing left is "from __future__ import division", which make

Re: Calculating future dates

2007-02-01 Thread Dan Bishop
On Feb 1, 6:51 pm, "Toine" <[EMAIL PROTECTED]> wrote: > Hello, > > I'm new to Python so please bare with me... > > I need to calculate a date that is exactly 31 days from the current > date in -MM-DD format. I know that date.today() returns the > current date, but how can I add 31 days to this

Python code to do the *server* side of digest authentication?

2007-02-15 Thread Dan Lenski
oll my own in this case. Does anyone have any suggestions of where to find such code? Thanks! Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python code to do the *server* side of digest authentication?

2007-02-15 Thread Dan Lenski
e identical to the first pair, but they are handled by the proxy; if the client isn't authorized, then they can't use the proxy. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python have equivalent to MATLAB "varargin", "varargout", "nargin", "nargout"?

2007-02-18 Thread Dan Bishop
On Feb 18, 12:58 pm, [EMAIL PROTECTED] wrote: > Thank you in advance for your response. > Dmitrey The Python equivalent to "varargin" is "*args". def printf(format, *args): sys.stdout.write(format % args) There's no direct equivalent to "varargout". In Python, functions only have one return

HTTP proxy server for Motorola E815 phone in Python

2007-02-22 Thread Dan Lenski
a connection when it says it's going to? Any advice on improving the code is appreciated! Thanks, Dan Lenski -- http://mail.python.org/mailman/listinfo/python-list

<    13   14   15   16   17   18   19   20   21   22   >