Re: how to plot the FFT of a list of values

2020-12-05 Thread Dan Stromberg
On Sat, Dec 5, 2020 at 9:20 AM Boris Dorestand wrote: > I have 16 values of the period sequence 1, 2, 4, 8, 1, 2, 4, 8, ... I > compute its fourier transform using > > >>> from scipy import fft, ifft > >>> x = [1,2,4,8,1,2,4,8] > >>> fft(x) > array([ 30. +0.j, 0. +0.j, -6.+12.j, 0. +0.j, -1

Re: Regarding Regex timeout behavior to minimize CPU consumption

2020-12-06 Thread Dan Stromberg
On Sun, Dec 6, 2020 at 2:37 PM Barry wrote: > > On 5 Dec 2020, at 23:44, Peter J. Holzer wrote: > > > > On 2020-12-05 23:42:11 +0100, sjeik_ap...@hotmail.com wrote: > >> Timeout: no idea. But check out re.compile and re.iterfind as they > might > >> speed things up. > > > > I doubt that com

Re: linear algebric equations

2020-12-07 Thread Dan Stromberg
On Mon, Dec 7, 2020 at 11:36 AM Tito Sanò wrote: > Regarding the solution of linear algebraic equations I noticed a big > difference in the computation > > time in Python compared to the old fortran language. > > I have compared both the linelg and lapack.dgesv-lapack.zgesv modules with > the for

Re: Unable to pass dict from json.

2020-12-12 Thread Dan Stromberg
On Sat, Dec 12, 2020 at 4:05 PM Bischoop wrote: > > Here https://bpa.st/YBVA I've working code with dictionary only if used > dict from the code > (it's commented now) but when I load it I can print it from load > function (line 14) but at all have not a > clue how to pass the data so could use

Re: To check if number is in range(x,y)

2020-12-14 Thread Dan Stromberg
On Mon, Dec 14, 2020 at 1:23 PM Schachner, Joseph < joseph.schach...@teledyne.com> wrote: > >>> r = range(10) > So r is a list containing 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 > To get a list of consecutive int's, you can use, for EG: r = list(range(10)) -- https://mail.python.org/mailman/listinfo/python-

Re: To check if number is in range(x,y)

2020-12-14 Thread Dan Stromberg
On Mon, Dec 14, 2020 at 3:07 PM Dan Stromberg wrote: > > On Mon, Dec 14, 2020 at 1:23 PM Schachner, Joseph < > joseph.schach...@teledyne.com> wrote: > >> >>> r = range(10) >> So r is a list containing 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 >> > To get a lis

Re: dict.get(key, default) evaluates default even if key exists

2020-12-15 Thread Dan Stromberg
On Tue, Dec 15, 2020 at 9:57 AM Mark Polesky via Python-list < python-list@python.org> wrote: > Hi. > > # Running this script > > D = {'a':1} > def get_default(): > print('Nobody expects this') > return 0 > print(D.get('a', get_default())) > > # ...generates this output: > > Nobody exp

Re: dict.get(key, default) evaluates default even if key exists

2020-12-15 Thread Dan Stromberg
On Tue, Dec 15, 2020 at 11:05 AM Serhiy Storchaka wrote: > 15.12.20 19:07, Mark Polesky via Python-list пише: > > # Running this script > > > > D = {'a':1} > > def get_default(): > > print('Nobody expects this') > > return 0 > > print(D.get('a', get_default())) > > > > # ...generates

Re: Python concurrent.futures.ProcessPoolExecutor

2020-12-16 Thread Dan Stromberg
On Wed, Dec 16, 2020 at 9:23 AM Israel Brewster wrote: > > On Dec 16, 2020, at 7:04 AM, Rob Rosengard > wrote: > > > > Warning: I am new to this group > > Warning: I am not an expert at Python, I've written a few small > programs, and spend 20 hours of online classes, and maybe a book or two.

Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread Dan Stromberg
On Mon, Jan 11, 2021 at 2:22 PM Cameron Simpson wrote: > >I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they > >look kinda like adding a family room onto a 1986 double wide mobile > >home, and they look even more complicated than creating a GUI from > >scratch in C++ with a me

optimizing a program that just shuffles data, a bit like cat...

2005-09-22 Thread Dan Stromberg
...but with much bigger blocksizes, and with a netcat-like ability to use sockets. The program is at http://dcs.nac.uci.edu/~strombrg/pnetcat I'm a bit concerned about the program's performance, because it actually seems to get slower sometimes with larger blocksizes, which really isn't what I'd

Re: optimizing a program that just shuffles data, a bit like cat...

2005-09-23 Thread Dan Stromberg
On Fri, 23 Sep 2005 10:18:47 -0500, Oracle wrote: > On Fri, 23 Sep 2005 01:16:46 +0000, Dan Stromberg wrote: > >> [quoted text muted] > > Try using psyco and see if that helps. Also, sometimes smaller blocks are > better than large blocks. Try using smaller block sizes an

Re: Silly function call lookup stuff?

2005-09-27 Thread Dan Sommers
gt; Would you apply this optimization to all lookups in outer scopes, or >> just callables? Why? ;-) > Hmmm callables have probably the highest chance of being recalled. def print_the_results( list_of_things_with_results ): for x in list_of_things_with_results: print x.

Re: sorting tuples...

2005-09-27 Thread Dan Sommers
en each item in the dictionary can be just one (who, message) tuple. If the dates are not unique, then you'll have to manage each item of the dictionary as a list of (who, message) tuples. And before you ask: no, dictionaries are *not* sorted; you'll have to sort a separate

Re: Python 3! Finally!

2005-09-30 Thread Dan Sommers
the changes needed to merit a V3 weren't that big after all... Or maybe the python development team is smart enough to write python 3 such that its bzipped tarball has the same size and the same MD5 sum as the python 2.4.2 bzipped tarball ;-) Regards, Dan -- Dan Sommers <http://

Re: Recursive Property of Octal Numbers

2005-10-01 Thread Dan Christensen
;\xb6' > py> b[0] > '\xb6' > py> b[0][0] > '\xb6' Maybe this clarifies things? >>> b='a' >>> b[0] 'a' >>> b[0][0] 'a' >>> b[0] == b True Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: os.access with wildcards

2005-10-07 Thread Dan Sommers
quot; Don't put anything there: if glob.glob('2005*'): print 'there is at least one matching file' else: print 'there are no matching files' Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

rrdtool?

2005-10-10 Thread Dan Stromberg
What sort of rrdtool-related or rrdtool-like software is out there, in python? How does it compare to the many perl and/or php efforts? I really prefer python, but I'm not seeing much in the way of python software for this kind of thing just yet. But hopefully, I just overlooked it :) Thanks!

Re: Send password over TCP connection

2005-10-10 Thread Dan Stromberg
On Mon, 10 Oct 2005 08:06:27 -0700, dcrespo wrote: > Hi all, > > I have a program that serves client programs. The server has a login > password, which has to be used by each client for logging in. So, when > the client connects, it sends a string with a password, which is then > validated on the

Re: Send password over TCP connection

2005-10-10 Thread Dan Stromberg
On Mon, 10 Oct 2005 14:29:20 -0700, dcrespo wrote: > ¡Beautiful and elegant solution! > > Two copies of the password: one on the client, the other on the server. > > 1. Client wants to connect > 2. Server generates a random_alphanumeric_string and sends it to the > client > 3. Both Client and Se

Re: Send password over TCP connection

2005-10-10 Thread Dan Stromberg
On Mon, 10 Oct 2005 15:13:14 -0700, Paul Rubin wrote: > "dcrespo" <[EMAIL PROTECTED]> writes: >> [quoted text muted] > > No. It's vulnerable to dictionary search. Use SRP if you can. Where can I learn more about this? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Send password over TCP connection

2005-10-10 Thread Dan Stromberg
On Tue, 11 Oct 2005 01:21:55 +0200, Michael Ströder wrote: > Dan Stromberg wrote: >> [quoted text muted] > > http://www.faqs.org/rfcs/rfc2945.html > > Ciao, Michael. OK, thanks for the reference. I guess I neglected to stress that we're talking about using random

Re: rrdtool?

2005-10-10 Thread Dan Stromberg
On Mon, 10 Oct 2005 13:18:29 -0700, Grig Gheorghiu wrote: > By sheer coincidence I was looking into the same thing today. I just > downloaded the latest rrdtool release (rrdtool-1.2.11) and I noticed a > /bindings/python subdirectory. I haven't played with it yet, as I still > need to install tons

Re: Let My Terminal Go

2005-10-11 Thread Dan Stromberg
On Tue, 11 Oct 2005 03:30:23 -0700, Mystilleef wrote: > Hello, > > Thank you. That's all I needed. For some reason, I had always assumed > forking was an expensive process. I guess I was ill-informed. In a loop, yes, it's expensive. Done once, it's usually not unacceptable. -- http://mail.pyt

Two python database questions

2005-10-15 Thread Dan Stromberg
Hi folks. I'm working on some file indexing software, in python of course. Over the course of working on it, I've come upon two python+database related questions: 1) Is there a reason for the gdbm module in python 2.4.1 not to have a get method? This makes it a touch less dictionary-like. 2)

Re: Vim capable IDE?

2005-10-17 Thread Dan Farina
Chris Lasher wrote: > Hello, > Is there a Python-sensitive, Linux compatible IDE out there with > standard bells and whistles (source browser, symbolic debugger, etc.) > but with the action-per-keystroke editing capabilities of Vim? I have > failed to turn up such an IDE in my Googling and IDE pr

Re: Hygenic Macros

2005-10-18 Thread Dan Farina
David Pokorny wrote: > Hi, > > Just wondering if anyone has considered macros for Python. I have one > good use case. In "R", the statistical programming language, you can > multiply matrices with A %*% B (A*B corresponds to pointwise > multiplication). In Python, I have to type > > import Num

Python 2.3.4, Berkeley db 1.85, db file format not recognized

2005-10-26 Thread Dan M
I'm working on a script that will interface with sendmail on my FreeBSD box. I'm trying to read my access.db file (yes, it's for a quick and dirty SMTP-after-POP application). I'm trying: import bsddb bsddb.hashopen("access.db") but I get: bsddb._db.DBInvalidArgError: (22, 'Invalid argument -- ac

Re: Python 2.3.4, Berkeley db 1.85, db file format not recognized

2005-10-26 Thread Dan M
On Wed, 26 Oct 2005 14:23:49 -0500, skip wrote: > > Dan> import bsddb > Dan> bsddb.hashopen("access.db") > > Dan> but I get: > Dan> bsddb._db.DBInvalidArgError: (22, 'Invalid argument -- access.db: > unexpected file type or forma

Building 2.4.2 on OpenBSD 3.8

2005-10-29 Thread Dan M
I've been working with python 2.2.3 for the last couple of weeks, but would like to move up to 2.4. I grabbed the 2.4.2 tarball and attempted to install, but I get: gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -o Modules/python.o

Re: query a port

2005-10-29 Thread Dan M
# Port we want to test host=machine.to.test# Either IP address or FQDN s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((host, port)) print "We made the connection" except socket.error: print "Sorry, that port is

Re: query a port

2005-10-30 Thread Dan M
On Sat, 29 Oct 2005 23:21:16 -0700, eight02645999 wrote: > thanks alot! > that's all there is to it..so it's just a simple connect. If all you want to do is check that the given port is open on the given host, that's it. I tried it on my local box. When connecting to port 25, it made the connecti

Re: Why the nonsense number appears?

2005-10-31 Thread Dan Bishop
Steve Horsley wrote: > Ben O'Steen wrote: > > On Mon, October 31, 2005 10:23, Sybren Stuvel said: > >> Ben O'Steen enlightened us with: > >>> Using decimal as opposed to float sorts out this error as floats are > >>> not built to handle the size of number used here. > >> They can handle the size ju

Re: Most efficient way of storing 1024*1024 bits

2005-11-02 Thread Dan Bishop
Tor Erik Sønvisen wrote: > Hi > > I need a time and space efficient way of storing up to 6 million bits. The most space-efficient way of storing bits is to use the bitwise operators on an array of bytes: import array class BitList(object): def __init__(self, data=None): self._data = arr

Re: when and how do you use Self?

2005-11-03 Thread Dan Sommers
s of the class. > Context will make it both clear and obvious which use case is desired. Can I use the 'other' identifier in, e.g., an __add__ method? Please? ;-) Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Which Version of Linux

2005-11-05 Thread Dan M
On Sat, 05 Nov 2005 04:26:38 -0600, blahman wrote: > ok, i m going to use Linux for my Python Programs, mainly because i > need to see what will these fork() and exec() do. So, can anyone tell > me which flavour of linux i should use, some say that Debian is more > programmer friendly, or shold

O_DIRECT on stdin?

2005-11-07 Thread Dan Stromberg
Is there a way of setting O_DIRECT on a preexisting file like sys.stdin? Does C allow this sort of thing? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: O_DIRECT on stdin?

2005-11-07 Thread Dan Stromberg
On Mon, 07 Nov 2005 19:48:47 +, Gordon Burditt wrote: >> [quoted text muted] > > There is no O_DIRECT or fcntl() in Standard C. > > fcntl() operates on an open file descriptor, and the file descriptor > for stdin is 0. Two calls to fcntl(), one with F_GETFL and one > with F_SETFL, would do

Re: O_DIRECT on stdin?

2005-11-07 Thread Dan Stromberg
On Mon, 07 Nov 2005 20:42:50 +, Gordon Burditt wrote: >> [quoted text muted] > > Does O_DIRECT perhaps invoke some of the restrictions of "raw" > device files, where the current offset and transfer size must be a > multiple of some block size? (I don't see any mention of that in > FreeBSD's

Re: Floating numbers and str

2005-11-09 Thread Dan Bishop
Grant Edwards wrote: > On 2005-11-09, Tuvas <[EMAIL PROTECTED]> wrote: > > > I would like to limit a floating variable to 4 signifigant digits, when > > running thorugh a str command. > > Sorry, that's not possible. Technically, it is. >>> class Float4(float): ...def __str__(self): ...

Re: is parameter an iterable?

2005-11-15 Thread Dan Sommers
3 4 5 6 7 >>> foo("hello") h e l l o Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: is parameter an iterable?

2005-11-15 Thread Dan Sommers
else: > # re-raise the exception > raise But what it do_stuff tries to iterate over a non-sequence? Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: using openurl to log into Yahoo services

2005-11-16 Thread Dan Sommers
ot;challenge" field is created by yahoo's server based on the request that caused the server to serve the login page; perhaps it contains a hash of the user agent that sent the request. When you reply to that challenge at a much later time, or with a different user agent, or with som

Re: Simulating call-by-reference

2005-11-17 Thread Dan Sommers
results['foo'], etc. Or look up the Borg pattern in the ASPN cookbook and you can access the results as results.foo, etc. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Simulating call-by-reference

2005-11-17 Thread Dan Sommers
On Thu, 17 Nov 2005 12:31:08 -0800, [EMAIL PROTECTED] (Alex Martelli) wrote: > Dan Sommers <[EMAIL PROTECTED]> wrote: >... >> Put the results into a dictionary (untested code follows!): [ example code snipped ] >> Now you can access the results as results['f

Re: Underscores in Python numbers

2005-11-20 Thread Dan Bishop
Roy Smith wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > That's a tad unfair. Dealing with numeric literals with lots of digits is > > a real (if not earth-shattering) human interface problem: it is hard for > > people to parse long numeric strings. > > There are plenty of ways to make num

Re: How to paste python code on wordpress?

2005-11-21 Thread Dan Lowe
e sapces as they are when publishing > ariticles on the blog, You can enclose the code in a PRE block, like this: def foobar(): print "abc" if x == 3: print "def" print "ghi" If you don't care for how it renders in a browser, hac

Re: How to paste python code on wordpress?

2005-11-21 Thread Dan Lowe
ere those abbreviations stand for "less than" and "greater than") Before: if x < 5: After: if x < 5: Another common character in code that you "should" do similarly is the double quote ("). For that, use " Before: if x == "foo": A

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Dan Bishop
Steve R. Hastings wrote: > I have been studying Python recently, and I read a comment on one > web page that said something like "the people using Python for heavy math > really wish they could define their own operators". The specific > example was to define an "outer product" operator for matric

Timeout in urllib2

2005-11-23 Thread Dan M
I'm writing a system monitor script that needs to load web pages. I'm using urllib2.urlopen to get the pages, and I'm attempting to set the timeout value using socket.defaulttimeout. Specifically, I'm calling socket.defaultttimeout(10), then calling urllib2.urlopen to fetch a web page that never g

Re: (newbie) N-uples from list of lists

2005-11-23 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > Hello, > > i think it could be done by using itertools functions even if i can not > see the trick. i would like to have all available "n-uples" from each > list of lists. > example for a list of 3 lists, but i should also be able to handle any > numbers of items (any len

CGI question

2005-11-25 Thread Dan Stromberg
What's the best way of converting this: 'hide\\?http://www.dedasys.com/articles/programming_language_economics.html\x012005-07-20 14:48' ...to something easily usable in a python CGI script? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI question

2005-11-26 Thread Dan Stromberg
On Sat, 26 Nov 2005 13:26:11 +0100, Fredrik Lundh wrote: > Dan Stromberg wrote: > >> What's the best way of converting this: >> >> 'hide\\?http://www.dedasys.com/articles/programming_language_economics.html\x012005-07-20 >> 14:48' >> >

Re: Death to tuples!

2005-11-27 Thread Dan Bishop
Mike Meyer wrote: > It seems that the distinction between tuples and lists has slowly been > fading away. What we call "tuple unpacking" works fine with lists on > either side of the assignment, and iterators on the values side. IIRC, > "apply" used to require that the second argument be a tuple; i

Re: PYTHONDOCS on OSX

2005-11-28 Thread Dan Lowe
window, your .profile (and other similar files) aren't read. OSX doesn't work like Linux or Solaris; it doesn't launch the GUI from a shell environment. There are ways to get environment variables into the GUI, such as described here: http://tinyurl.com/8yvk9 -dan -- lo

Re: CGI question

2005-11-29 Thread Dan Stromberg
On Sat, 26 Nov 2005 13:26:11 +0100, Fredrik Lundh wrote: > Dan Stromberg wrote: > >> What's the best way of converting this: >> >> 'hide\\?http://www.dedasys.com/articles/programming_language_economics.html\x012005-07-20 >> 14:48' >> >

Re: Precision for equality of two floats?

2005-11-29 Thread Dan Sommers
l be) seemingly endless debates about this on comp.std.c (even without the possibility of NaNs, for similar reasons to the one you cite). I don't know if the Lisp and/or IEEE-754 crowds have worked all of this out. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: how to handle two forms in cgi?

2005-11-30 Thread Dan M
> My question is: How let these two form works together? I try to use > two codes for these two forms, e.g. Login.py for login form and > search.py for search form. But when user input data in search form and > click its submit button, it just comes back to login form. Second form > doesn't work.

Re: CGI question

2005-12-01 Thread Dan Stromberg
On Tue, 29 Nov 2005 12:53:26 -0800, Istvan Albert wrote: > See urlparse: > > http://www.python.org/doc/current/lib/module-urlparse.html This looks like precisely what I need for part of what I need to do. I'm stoked that it knows how to take apart the "?" stuff. I'm still wondering though, if

Re: advice : how do you iterate with an acc ?

2005-12-02 Thread Dan Sommers
d see what it does (since your code is conceptually very similar to it). OTOH, FWIW, your version is very clean and very readable and fits my brain perfectly. HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute an EXE via os.system() with spaces in the directory name?

2005-12-04 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > I am trying to run an exe within a python script, but I'm having > trouble with spaces in the directory name. ... > So, it looks to me like the space in the path for the argument is > causing it to fail. Does anyone have any suggestions that could help > me out? Does C:

Re: Python Equivalent to Text::Autoformat

2005-12-04 Thread Dan Sommers
t; formatters use: most require an empty line to terminate a paragraph. > Paragraphs may also be denoted by bulleting, numbering, or quoting . . > ." Try the formatter module: http://www.python.org/doc/current/lib/module-formatter.html Regards, Dan -- Dan Sommers <http://www.

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > [EMAIL PROTECTED] wrote: > > > [EMAIL PROTECTED] wrote: > > > > > and, as you just found out, a rather restrictive one > > > > > at that. > > > > > > > > In part because Python's designers failed to make "print" a function > > > > or provide

Re: Python riddle

2005-12-05 Thread Dan Bishop
kyle.tk wrote: > SPE - Stani's Python Editor wrote: > > I know that this code is nonsense, but why does this print 'Why?' > > > > a = 1 > > if a >2: > > try: > > 5/0 > > except: > > raise > > else: > > print 'why?' > > last time i checked this should print 'why?' > I hav

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-07 Thread Dan Sommers
chance that x might be useful elsewhere, then I should have called it something other than x (or immediately rename it as soon as I start to think about using its contents again). (Okay, now I sound like a curmudgeon, but I'm not. At least I don't think I am. I'm just trying to present an alternate view, one in which the issue of needing more scoping controls isn't an issue.) Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Python web publishing framework like Cocoon?

2005-12-07 Thread Dan M
> Is there a Python web publishing framework like Cocoon? > > I found Maki but it was last updated in > 2003 and its author says that he doesn't want to make another release... How about: http://www.cherrypy.org/ http://www.turbogears.org/ http://www.djangoproject.

Re: Bitching about the documentation...

2005-12-07 Thread Dan Sommers
ver-ambiguous: Women can fish. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: new in programing

2005-12-09 Thread Dan Bishop
Cameron Laird wrote: ... > for hextuple in [(i, j, k, l, m, n) > for i in range(1, lim + 1) \ > for j in range (1, lim + 2) \ > for k in range (1, lim + 3) \ > for l in range (1, lim + 4) \ > for m in range (1, lim + 5) \ > for n in range (1,

Re: OT: spacing of code in Google Groups

2004-12-31 Thread Dan Bishop
M.E.Farmer wrote: > Grant Edwards wrote: > >Not sure what Google Groups does to it... > The usual... it mangles it. > I don't get it, Google uses Python too, they know it is whitespace > signifigant. And for a long time, Google groups postings *were* whitespace significant. But the new interface

Re: Calling Function Without Parentheses!

2005-01-02 Thread Dan Bishop
Kamilche wrote: > What a debug nightmare! I just spent HOURS running my script through > the debugger, sprinkling in log statements, and the like, tracking down > my problem. > > I called a function without the ending parentheses. I sure do WISH > Python would trap it when I try to do the following

Re: Zope newsgroups? Need help with POSKeyError

2005-01-03 Thread Dan Stromberg
On Sat, 01 Jan 2005 10:47:41 +1100, richard wrote: > Bob Horvath wrote: >> I have a Zope/Plone combination that I have been having POSKeyErrors >> with for a while now. Are there any newsgroups that deal with Zope? > > No, but there is a mailing list - see zope.org > > Also, try google searchin

Re: Cookbook 2nd ed Credits

2005-01-05 Thread Dan Perl
? Updating the status of the recipes on the web site would be nice. Dan > > Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Cookbook 2nd ed Credits

2005-01-05 Thread Dan Perl
"Alex Martelli" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dan Perl <[EMAIL PROTECTED]> wrote: > >> "Alex Martelli" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > Premshree Pillai <[EMAI

Re: BASIC vs Python

2005-01-05 Thread Dan Bishop
Christos TZOTZIOY Georgiou wrote: > On 17 Dec 2004 15:53:51 -0800, rumours say that "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> might have written: > > >> The BASICs of my youth also supported graphics and sounds. > >> > >> PLAY "CGFED>CC > > >Now wait a minute, shouldn't that be... > > > >PLAY "CG

Re: how to extract columns like awk $1 $5

2005-01-07 Thread Dan Valentine
cept: return "" >>> print awk_it("a b c d e",0) a b c d e >>> print awk_it("a b c d e",1) a >>> print awk_it("a b c d e",5) e >>> print awk_it("a b c d e",6) - dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Long strings as function parameters

2005-01-09 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > I would like to have functions that operate on long strings, 10-100 MB. > In C I would of course pass a pointer to the string for a quick > function call. What is an efficient way to do this in python? > Cheers, In Python, *every* expression is a pointer. This fact is

Re: else condition in list comprehension

2005-01-09 Thread Dan Bishop
Luis M. Gonzalez wrote: > Hi there, > > I'd like to know if there is a way to add and else condition into a > list comprehension. I'm sure that I read somewhere an easy way to do > it, but I forgot it and now I can't find it... > > for example: > z=[i+2 for i in range(10) if i%2==0] > what if I wan

Re: CGI, anydbm.open() and linux file permissions

2005-01-11 Thread Dan Sommers
robably runs as user "nobody" or another special user ID set up specifically for running CGI scripts (rather than your user id). Check your web server's documentation, or render the output of sys.getuid, sys.geteuid, sys.getgid, and sys.getedig. One solution is to op

Re: Checking for X availability

2005-01-11 Thread Dan Stromberg
On Tue, 11 Jan 2005 03:32:01 -0800, Flavio codeco coelho wrote: > I have a program that uses pythondialog for its UI. > > Pythondialog is a wrapper of the shell dialog and xdialog libs. > > But I would like for it to switch between using Dialog ( when X is not > available ) and xdialog (when X

Re: Octal notation: severe deprecation

2005-01-13 Thread Dan Sommers
ier" like aa is read by the parser as a numeric constant with the decimal value of 170. Obviously, this has to be used with care, but makes reading external data files written in strange bases very easy. > nothing-new-under-the-sun-ly y'rs - steve every-language-

Re: Python.org, Website of Satan

2005-01-13 Thread Dan Bishop
DogWalker wrote: > "Luis M. Gonzalez" <[EMAIL PROTECTED]> said: > > >[EMAIL PROTECTED] wrote: > >> python.org = 194.109.137.226 > >> > >> 194 + 109 + 137 + 226 = 666 > >> > >> What is this website with such a demonic name and IP address? What > >> evils are the programmers who use this language up

Re: why are some types immutable?

2005-01-16 Thread Dan Bishop
Roy Smith wrote: > Torsten Mohr <[EMAIL PROTECTED]> wrote: > > reading the documentation (and also from a hint from this NG) > > i know now that there are some types that are not mutable. > > > > But why is it this way? > > > > From an overhead point of view i think it is not optimal, > > for examp

buffered socket class

2005-01-17 Thread Dan Stromberg
I finally took a moment to put my buffered socket class, bufsock.py, on a web page. It's a wrapper class for python sockets. It should reduce tinygrams, as well as provide a more convenient interface to the application programmer. It includes functions for reading a certain number bytes, readin

Re: Integration with java

2005-01-18 Thread Dan Bishop
Istvan Albert wrote: > Joachim Boomberschloss wrote: > > > the code is already written in Python, using the > > standard libraries and several extension modules > > One thing to keep in mind is that Jython does not > integrate CPython, instead it "understands" python code > directly. So if you ha

Re: python/cgi/html bug

2005-01-18 Thread Dan Bishop
Dfenestr8 wrote: > Hi. > > I've written a cgi messageboard script in python, for an irc chan I happen > to frequent. > > Bear with me, it's hard for me to describe what the bug is. So I've > divided this post into two sections: HOW MY SCRIPTS WORKS, and WHAT THE > BUG IS. > ... > The problem is wh

pure python code to do modular-arithmetic unit conversions?

2005-01-21 Thread Dan Stromberg
Is there already a pure python module that can do modular-arithmetic unit conversions, like converting a huge number of seconds into months, weeks... or a bandwidth measure into megabits/s or gigabits/s or megabytes/s or gigabytes/s, whatever's the most useful (ala df -h)? Thanks! -- http://mai

Re: pure python code to do modular-arithmetic unit conversions?

2005-01-21 Thread Dan Bishop
Dan Stromberg wrote: > Is there already a pure python module that can do modular-arithmetic unit > conversions, like converting a huge number of seconds into months, > weeks... Use the divmod function. SECONDS_PER_MONTH = 2629746 # 1/4800 of 400 Gregorian years def convert_second

Re: how to write a tutorial

2005-01-23 Thread Dan Perl
"Xah Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > the beginning two paragraphs should be deleted. Nobody gives a shit > except a few smug academicians where the author wrote it for pleasing > himself. For 99% of readers, it is incomprehensible and irrelevant. > > the first p

Re: Python 2.1 - 2.4 differences

2005-01-24 Thread Dan Perl
re several good on-line tutorials. But if getting published books is difficult in your country, then I would heartily recommend Safari Books Online (http://www.safaribooksonline.com/). I have been using it for a few months and I find it to be very useful. Dan "BOOGIEMAN" <[EMAIL

Re: [perl-python] 20050125 standard modules

2005-01-25 Thread Dan Perl
I sent the following feedback message to Yahoo! Groups about this abusive use of their service. Feel free to also report this as an abuse of the Yahoo! Groups service until the problem is resolved. Dan --- As the owner of the perl-python group, p0lyglut (aka Xah Lee), has added two

Re: [perl-python] 20050125 standard modules

2005-01-25 Thread Dan Perl
I was wrong. He is just crossposting to the newsgroups without having them as members of the group. I wish there was a good way like that to stop these daily postings! Dan "Dan Perl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I sent the following feedba

Re: string.atoi and string.atol broken?

2005-01-25 Thread Dan Bishop
Peter Otten wrote: > Mike Moum wrote: > > > s.atoi('4',3) should result in 11 > > > > s.atoi('13',4) should result in 31 > > > > s.atoi('12',4) should result in 30 > > > > s.atoi('8',4) is legitimate, but it generates an error. > > > > Is this a bug, or am I missing something obvious? > > You and a

Re: 20050126 find replace strings in file

2005-01-26 Thread Dan Perl
27;s talking about. I find Xah Lee annoying and I could just ignore him, but I am concerned that some people may actually take his statements seriously and learn from them. I can't imagine why or how, but there are actually 26 members in the perl-python Yahoo! group who have registered to

Re: exclude binary files from os.walk

2005-01-26 Thread Dan Perl
"rbt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there an easy way to exclude binary files (I'm working on Windows XP) > from the file list returned by os.walk()? > > Also, when reading files and you're unsure as to whether or not they are > ascii or binary, I've always th

Re: Talking to the wind

2005-01-27 Thread Dan Perl
thdrawn, indifferent, unresponsive, and disinterested. Such a person prefers solitary to gregarious pursuits, involvement with things rather than with people, and often appears humourless or dull." Does that explain things for you? I really think that nothing we say gets through to him. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test that an exception is raised ?

2005-01-28 Thread Dan Perl
"StepH" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > But i've prob with the 1st test : test_badFile. > When I run the test, unittest say that no error is Raised. > But when I run the mps2xml module with a bad file as arg., the exception > is > well Raised. I assume you don't ac

Re: How to test that an exception is raised ?

2005-01-28 Thread Dan Perl
"StepH" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Do you say that it's not possible to test (using unittest) if an exception > is well raised if the tested code catch it ? > How to solve this paradoxe ? How to automaticaly test such code ? Then you need a side-effect in ca

Re: How to test that an exception is raised ?

2005-01-28 Thread Dan Perl
er function B and B throws an exception of type C, then you must catch the exception C in A or you have to declare A that it "throws C". Hope this helps. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: what's OOP's jargons and complexities?

2005-01-28 Thread Dan Perl
"Xah Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > public class test { > public static void main(String[] args) { > String a = new String("a string"); > String b = new String("another one"); > StringBuffer c = new StringBuffer(40); > c.append(a); c.append(b); > System.out.pri

Re: what's OOP's jargons and complexities?

2005-01-28 Thread Dan Perl
"Dan Perl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Actually, it can be as simple as: > public class test { >public static void main(String[] args) { >String c = new String("a string"+" another one"); >S

<    5   6   7   8   9   10   11   12   13   14   >