Re: which datastructure for fast sorted insert?

2008-05-25 Thread Rares Vernica
use a set to store them: >>> s=set() >>> s.add('a') >>> s.add('b') >>> s set(['a', 'b']) >>> s.add('a') >>> s set(['a', 'b']) >>> s.add('c') >>> s set(['a', 'c', 'b']) >>> it does remove duplicates, but is it not ordered. to order it you can use: >>> l=list(s) >>> l.sort() >>> l ['a', 'b', 'c']

Re: which datastructure for fast sorted insert?

2008-05-25 Thread notnorwegian
On 25 Maj, 08:56, Rares Vernica <[EMAIL PROTECTED]> wrote: > use a set to store them: > > >>> s=set() > >>> s.add('a') > >>> s.add('b') > >>> s > set(['a', 'b']) > >>> s.add('a') > >>> s > set(['a', 'b']) > >>> s.add('c') > >>> s > > set(['a', 'c', 'b']) > > > > it does remove duplicates, but is it

Re: finding icons for Apps

2008-05-25 Thread Francesco Bochicchio
On Sat, 24 May 2008 21:42:57 -0700, Sanoski wrote: > This might be a dumb question. I don't know. I'm new to all this. How > do you find icons for your programs? All GUI applications have cool > icons that represent various things. For instance, to save is often > represented as a disk, etc. You k

recursion with or without return?

2008-05-25 Thread notnorwegian
when using recursion should one use a return statement or not? there is a difference obv since with a return statement it will ultimately return a value if not recursing forever. but is there a guideline for this or it just taste or is it considering good style or pythonic to always have a return

Re: module import problem

2008-05-25 Thread Milos Prudek
> Reinstall the package "python-gnupginterface" with "sudo aptitude reinstall Your advice helped! Upgrade is running now. Thanks! -- Milos Prudek -- http://mail.python.org/mailman/listinfo/python-list

Re: recursion with or without return?

2008-05-25 Thread Marc 'BlackJack' Rintsch
On Sun, 25 May 2008 00:00:14 -0700, notnorwegian wrote: > when using recursion should one use a return statement or not? This decision has nothing to do with recursion. It's the same as in non recursive functions. If the function calculates something that you want to return to the caller you ha

Re: which datastructure for fast sorted insert?

2008-05-25 Thread Marc 'BlackJack' Rintsch
On Sun, 25 May 2008 00:10:45 -0700, notnorwegian wrote: > sets dont seem to be so good because there is no way to iterate them. Err: In [82]: for x in set(['a', 'b', 'c']): : print x : a c b Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/pyth

Re: webspider getting stuck

2008-05-25 Thread John Nagle
[EMAIL PROTECTED] wrote: i am writing a simple webspider . how do i avoid getting stuck at something like this: Enter username for W3CACL at www.w3.org: ? It's a silly feature of urllib. See http://docs.python.org/lib/module-urllib.html where it says: "Note: When performing basic authe

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Martin v. Löwis
> I guess, Apache does some kind of memory caching for files, which are often > requested and small enough to fit into the system memory. Are you sure about this? I could not find anything in the documentation (other than mod_cache and friends, which is an unrelated functionality). Also, I don't

Re: Why does python not have a mechanism for data hiding?

2008-05-25 Thread Ville M. Vainio
Fuzzyman <[EMAIL PROTECTED]> writes: >> Perhaps a lint-like validation tool would be optimal for this >> problem... > > So we can refuse to execute their code if they use private APIs? No, but it could complain and point out the exact offending lines, pointing their development effort to right d

Re: Newbie Question: How to use a .pth file on a Macintosh

2008-05-25 Thread martin . laloux
you put your pth file in (same configuration: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Code correctness, and testing strategies

2008-05-25 Thread Matthew Woodcraft
Michael L Torrie <[EMAIL PROTECTED]> wrote: > Watch your programmers then. They do have to write and debug the > code. And they will spend at least as much or more time debugging as > writing the code. It's a fact. I have several programmers working > for me on several projects. What you have

Re: Showing the method's class in expection's traceback

2008-05-25 Thread Duncan Booth
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 22 May 2008 07:55:44 -0300, Duncan Booth > <[EMAIL PROTECTED]> escribió: >> Bruno Desthuilliers <[EMAIL PROTECTED]> >> wrote: >> >>> Not to say that your concerns are pointless, and that things cannot >>> be improved somehow, but this is n

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Sebastian 'lunar' Wiesner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [ "Martin v. Löwis" <[EMAIL PROTECTED]> ] >> I guess, Apache does some kind of memory caching for files, which are >> often requested and small enough to fit into the system memory. > > Are you sure about this? No, I'm not. That's why I said "I gu

Re: Why does python not have a mechanism for data hiding?

2008-05-25 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > Ben Finney: >>In Python, the philosophy "we're all consenting adults here" applies.< > > Michael Foord: >> They will use whatever they find, whether it is the best way to >> achieve a goal or not. Once they start using it they will expect us to >> maintain it - and us t

access interactive namespace from module (shared namespace?)

2008-05-25 Thread Ulrich Dorda
I've got a probably embarrassing trivial problem with namespaces, but couldn't solve it myself nor find an answer in the net. Hopefully one of you guys can help me. What I want to do: Use the interactive shell and e.g define the variable a there. Then load a module and access a from within. e.g

Re: Why does python not have a mechanism for data hiding?

2008-05-25 Thread Fuzzyman
On May 25, 2:28 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Benjamin Kaplan" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | On Sat, May 24, 2008 at 10:14 AM, Fuzzyman <[EMAIL PROTECTED]> wrote: > || > For example, at Resolver Systems we expose the spreadsheet object > | > m

Re: access interactive namespace from module (shared namespace?)

2008-05-25 Thread TeroV
Ulrich Dorda wrote: I've got a probably embarrassing trivial problem with namespaces, but couldn't solve it myself nor find an answer in the net. Hopefully one of you guys can help me. What I want to do: Use the interactive shell and e.g define the variable a there. Then load a module and acce

Re: Newbie Question: How to use a .pth file on a Macintosh

2008-05-25 Thread Ivan Illarionov
Robbie wrote: > I can't seem to figure out where to put this file so that Python will > recognize it when I start it up. You need to put this file in your site-packages directory. To get the location of your site-packages directory, type in Python interactive shell: from distutils.sysconfig impo

Re: access interactive namespace from module (shared namespace?)

2008-05-25 Thread ulrich
Thanks for the reply, Of course the suggested solution is working and good, but a bit complicated. The module/function where i need to access the variable value from the interactive shell is burried quite deep and I would nedd to hand the locals() quite often from one module to another. Furthermor

Re: access interactive namespace from module (shared namespace?)

2008-05-25 Thread Peter Otten
Ulrich Dorda wrote: > I've got a probably embarrassing trivial problem with namespaces, but > couldn't solve it myself nor find an answer in the net. Hopefully one of > you guys can help me. > > What I want to do: > Use the interactive shell and e.g define the variable a there. > Then load a modu

Re: Why does python not have a mechanism for data hiding?

2008-05-25 Thread Ville M. Vainio
Duncan Booth <[EMAIL PROTECTED]> writes: > Or if you code in C++ and they *really* need to get at something you > made private they will still get at it. I've been there and done > that: 'private' in languages which have it is rarely an advantage > and frequently a pain. Indeed. In C++, they rec

Re: Python, Daemons and D-Bus

2008-05-25 Thread Diez B. Roggisch
PurpleServerMonkey schrieb: On May 25, 5:46 am, Sebastian 'lunar' Wiesner <[EMAIL PROTECTED]> wrote: [ PurpleServerMonkey <[EMAIL PROTECTED]> ] Would you use D-Bus or a more traditional IPC method such as sockets? Although D-Bus is relatively new it looks interesting, just not sure it would wo

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Diez B. Roggisch
Roy Smith schrieb: In article <[EMAIL PROTECTED]>, Fuzzyman <[EMAIL PROTECTED]> wrote: Also, like others, I have had wonderful experiences of trying to track down test failures that depend on the order that tests run in. Having interdependencies between tests is a recipe for madness... I ag

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Diez B. Roggisch
Sebastian 'lunar' Wiesner schrieb: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [ Diez B. Roggisch <[EMAIL PROTECTED]> ] I finally managed to work with static files with a little hack, but it's ugly because I'm reading each static file per request. How else should that work? Apache does that

Re: access interactive namespace from module (shared namespace?)

2008-05-25 Thread David C. Ullrich
On Sun, 25 May 2008 03:32:30 -0700 (PDT), [EMAIL PROTECTED] wrote: >Thanks for the reply, > >Of course the suggested solution is working and good, but a bit >complicated. The module/function where i need to access the variable >value from the interactive shell is burried quite deep and I would >ne

Getting a set of lambda functions

2008-05-25 Thread Martin Manns
Hi, I try to get a set of lambda functions that allows me executing each function code exactly once. Therefore, I would like to modify the set function to compare the func_code properties (or the lambda functions to use this property for comparison). (The reason is that the real function list is

Re: Getting a set of lambda functions

2008-05-25 Thread Ivan Illarionov
On Sun, 25 May 2008 13:43:15 +0200, Martin Manns wrote: > Hi, > > I try to get a set of lambda functions that allows me executing each > function code exactly once. Therefore, I would like to modify the set > function to compare the func_code properties (or the lambda functions to > use this prop

Re: Getting a set of lambda functions

2008-05-25 Thread Ivan Illarionov
On Sun, 25 May 2008 13:43:15 +0200, Martin Manns wrote: > Hi, > > I try to get a set of lambda functions that allows me executing each > function code exactly once. Therefore, I would like to modify the set > function to compare the func_code properties (or the lambda functions to > use this prop

Re: Why does python not have a mechanism for data hiding?

2008-05-25 Thread Fuzzyman
On May 25, 9:47 am, [EMAIL PROTECTED] (Ville M. Vainio) wrote: > Fuzzyman <[EMAIL PROTECTED]> writes: > >> Perhaps a lint-like validation tool would be optimal for this > >> problem... > > > So we can refuse to execute their code if they use private APIs? > > No, but it could complain and point out

Re: which datastructure for fast sorted insert?

2008-05-25 Thread Benjamin Kaplan
On Sun, May 25, 2008 at 3:10 AM, <[EMAIL PROTECTED]> wrote: > > > >>> l=list(s) > > >>> l.sort() > > >>> l > > > > ['a', 'b', 'c'] > > > > hth, > > Rares > > sets dont seem to be so good because there is no way to iterate them. > > s.pop() remove and return an arbitrary element fro

Re: Getting a set of lambda functions

2008-05-25 Thread Martin Manns
On Sun, 25 May 2008 12:14:25 + (UTC) Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Sun, 25 May 2008 13:43:15 +0200, Martin Manns wrote: > > Maybe make a set of code objects? > > func_code_set = set([f.func_code for f in funclist]) > > funclist = [] > for fc in func_code_set: > f = lam

Re: access interactive namespace from module (shared namespace?)

2008-05-25 Thread ulrich
Thanks a lot to all! Apart from obtaining the solution I was searching for, I learned a lot by studying your answers! Cheers, Ulrich -- http://mail.python.org/mailman/listinfo/python-list

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Matthew Woodcraft
Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >Sebastian 'lunar' Wiesner schrieb: >> I guess, Apache does some kind of memory caching for files, which are often >> requested and small enough to fit into the system memory. May be, that's >> what the OP is referring to ... > I'm not aware of that, an

Re: unittest: Calling tests in liner number order

2008-05-25 Thread John Roth
On May 24, 7:22 am, André <[EMAIL PROTECTED]> wrote: > > I can't relate to anyone that want to oppose a change that would give > more freedom to a programmer. > > André Well, you can already do that. Or anything else you want. It's not all that difficult to change the algorithms in the unittest p

Coverage checker: Coverage.py or pycover or ?

2008-05-25 Thread python
Looking for feedback from people using a coverage checking utility. I've found two - wondering if there's any feature that would recommend one of these utilities vs. another (or argue for the use of both utilities). Coverage.py http://nedbatchelder.com/code/modules/coverage.html and Pycover http

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Diez B. Roggisch
Matthew Woodcraft schrieb: Diez B. Roggisch <[EMAIL PROTECTED]> wrote: Sebastian 'lunar' Wiesner schrieb: I guess, Apache does some kind of memory caching for files, which are often requested and small enough to fit into the system memory. May be, that's what the OP is referring to ... I'm n

Re: raising an exception when multiple inheritance involves same baseThank

2008-05-25 Thread Michael Hines
Thanks very much, Arnaud. That is exactly the hint I needed. Since it is not multiple inheritance per se I prohibit but only multiple inheritance involving more than one HocObject class, I replaced your len(bases) > 1 test with m = False for b in bases : if hasattr(b, '__mro__'):

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Roy Smith
In article <[EMAIL PROTECTED]>, John Roth <[EMAIL PROTECTED]> wrote: > I really don't care what the OP does in his own projects. My objection > is that, if it goes into the standard library, is that it passes a > signal that it's good practice to allow dependencies between tests. It > most defin

Re: Python database 'frontends', what's available?

2008-05-25 Thread tinnews
Mike Driscoll <[EMAIL PROTECTED]> wrote: > On May 23, 1:59 pm, [EMAIL PROTECTED] wrote: > > I'm desperately trying to move a Microsoft Access database application > > (a simple accounts system I wrote myself) to Linux.  Python is one of > > my preferred programming laguages so I wonder if there are

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Roy Smith
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > I agree that tests should not depend on each other, but sometimes it's > > still useful to have the tests run in a certain order for reporting > > purposes. > > Then sort your report. Seriously. A test-outpt shoud be in a way that > delimits in

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Fuzzyman
On May 25, 3:13 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, >  John Roth <[EMAIL PROTECTED]> wrote: > > > I really don't care what the OP does in his own projects. My objection > > is that, if it goes into the standard library, is that it passes a > > signal that it

Re: finding icons for Apps

2008-05-25 Thread Kevin Walzer
Sanoski wrote: This might be a dumb question. I don't know. I'm new to all this. How do you find icons for your programs? All GUI applications have cool icons that represent various things. For instance, to save is often represented as a disk, etc. You know, the small little picture references th

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Diez B. Roggisch
Here's an example of why *running* tests in order can make sense. You could have a bunch of tests of increasing complexity. The first bunch of tests all run in a few seconds and test some basic functionality. From experience, you also know that these are the tests that are most likely to f

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Diez B. Roggisch
In fact, from a protocol point of view, some of the types really do depend on each other. We send counted strings, for example, so we can't send a string until we know how to send an int (for the string length). If the first test that fails is the string test, I know right off that the problem

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Martin v. Löwis
>>> I guess, Apache does some kind of memory caching for files, which are often >>> requested and small enough to fit into the system memory. May be, that's >>> what the OP is referring to ... > >> I'm not aware of that, and I even more seriously doubt it. Because >> caching is a complicated, do

RE: unittest: Calling tests in liner number order

2008-05-25 Thread Ryan Ginstrom
> On Behalf Of Roy Smith > You could have a bunch of tests of increasing complexity. > The first bunch of tests all run in a few seconds and test > some basic functionality. From experience, you also know > that these are the tests that are most likely to fail as you > port to a new environme

SocketServer, its offspring, and threads

2008-05-25 Thread eliben
Hello, I have a small wxPython application. Today I was trying to add some RPC capability to it, so I implemented an instance of SimpleXMLRPCServer that runs in a separate thread when invoked and answers requests. All went fine until I realized that I have to sometimes stop the server - which is

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Matthew Woodcraft
Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >I don't see this as something that can be solved by ordering tests - >*especially* not on a per-method-level as the OP suggested, because I >tend to have test suites that span several files. unittest already runs multiple test suites in the order you

Re: which datastructure for fast sorted insert?

2008-05-25 Thread Gabriel Genellina
En Sun, 25 May 2008 03:37:00 -0300, <[EMAIL PROTECTED]> escribió: > im writing a webcrawler. > after visiting a new site i want to store it in alphabetical order. > > so obv i want fast insert. i want to delete duplicates too. > > which datastructure is best for this? Use a list, and the bisect m

Pinging a machine from python

2008-05-25 Thread Prasanth
I tried pinging a machine from python using socket programming but could not do it. Is there any module which we can use to ping the machine < like net::ping in perl> or can you give me simple program. -- http://mail.python.org/mailman/listinfo/python-list

Re: finding icons for Apps

2008-05-25 Thread jim-on-linux
Learn how to use Gimp, Make your own icons, of and from anything. You can use screen shots and picks from anywhere. Import your own photos and modify any pic however you want. Check them out, free download, tutorial. http://www.gimp.org jim-on-linux http://www.inqvista.com > Sanoski wro

Re: Assignment and comparison in one statement

2008-05-25 Thread TheSaint
On 19:14, sabato 24 maggio 2008 Johannes Bauer wrote: > Well, I do not really see your point You wrote C statements and I felt that you were trying to apply to python interpreter. I think that a minimun of knoweledge on python grammar it's the base for doing some programming. If your examples were

Re: raising an exception when multiple inheritance involves same baseThank

2008-05-25 Thread Paul McGuire
On May 25, 8:37 am, Michael Hines <[EMAIL PROTECTED]> wrote: > Thanks very much, Arnaud. That is exactly the hint I needed. Since it is > not multiple inheritance per se I prohibit but only multiple inheritance > involving more than one HocObject class, I replaced your len(bases) > 1 > test with >

Re: which datastructure for fast sorted insert?

2008-05-25 Thread Terry Reedy
"Rares Vernica" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | >>> l=list(s) | >>> l.sort() This can be condensed to l = sorted(s) | >>> l | ['a', 'b', 'c'] -- http://mail.python.org/mailman/listinfo/python-list

Python web development that resembles PHP or classic ASP

2008-05-25 Thread erik . oosterwaal
Hi All, I have been developing websites in classic asp using VB script for a long while now. Due to the fact that I also took a detour to developing ColdFusion, and the fact the companies I work(ed) for never had time or money for courses, I am now in the awkward position that I am -still- develop

Re: Python web development that resembles PHP or classic ASP

2008-05-25 Thread Patrick Mullen
Hi Erik, As far as I know the only full web framework that works with a primarily inline style is spyce, which is not currently under active development. I used it for a while and it was the first python framework I used. I think it's pretty good, if a little bit of an underdog. That said, usin

UTF problem?

2008-05-25 Thread Vesa-Matti Sarenius
I am trying to set up Linux printing via Windows XP and using this HOWTO: http://justin.yackoski.name/winp/ I have one problem. When I send a file via CUPS to the windows spool directory dirwatch.py (http://justin.yackoski.name/winp/dirwatch.txt) dies and gives: UnicodeEncodeError: 'ascii' codec

Re: raising an exception when multiple inheritance involves same baseThank

2008-05-25 Thread Arnaud Delobelle
Sorry I lost the original post. Paul McGuire <[EMAIL PROTECTED]> writes: > On May 25, 8:37 am, Michael Hines <[EMAIL PROTECTED]> wrote: >> Thanks very much, Arnaud. That is exactly the hint I needed. Since it is >> not multiple inheritance per se I prohibit but only multiple inheritance >> invol

Re: Python is slow

2008-05-25 Thread Lie
On May 23, 2:50 pm, Bruno Desthuilliers wrote: > Brad a écrit : > > > cm_gui wrote: > >> Python is slow. > > > It ain't C++, but it ain't a punch card either... somewhere in between. > > I find it suitable for lots of stuff. I use C++ when performance really > > matters tho... right tool for the

Re: Code correctness, and testing strategies

2008-05-25 Thread David
Hi again. Taking the advice of numerous posters, I've been studying BDD further. I spent a while looking for a Python library which implemented BDD in Python similar to jbehave, as described by Dan North on this page: http://dannorth.net/introducing-bdd. I did find a few, but they either had awfu

Re: php vs python

2008-05-25 Thread Lie
On May 22, 12:28 pm, NC <[EMAIL PROTECTED]> wrote: > On May 21, 1:10 pm, notbob <[EMAIL PROTECTED]> wrote: > > > > > So, here's my delimna: I want to start a blog.  Yeah, who doesn't. > > Yet, I want learn the guts of it instead of just booting up some > > wordwank or whatever. > > Here's a simple

Re: which datastructure for fast sorted insert?

2008-05-25 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > im writing a webcrawler. > after visiting a new site i want to store it in alphabetical order. > > so obv i want fast insert. i want to delete duplicates too. > > which datastructure is best for this? Keep the data redundantly in two data structures. Use collections.de

Re: Pinging a machine from python

2008-05-25 Thread Sebastian 'lunar' Wiesner
[ Prasanth <[EMAIL PROTECTED]> ] > I tried pinging a machine from python using socket programming but > could not do it. Is there any module which we can use to ping the > machine < like net::ping in perl> or can you give me simple program. At least on linux pinging requires raw sockets since ther

Re: php vs python

2008-05-25 Thread Lie
On May 23, 5:14 am, "inhahe" <[EMAIL PROTECTED]> wrote: > I don't like php.  I tried it once and I had it sort a list, but the list > was apparently too long for its sorting function because it just sorted the > first so-many elements of it and left the rest in order, and didn't generate > any erro

Re: raising an exception when multiple inheritance involves same baseThank

2008-05-25 Thread Gabriel Genellina
En Sun, 25 May 2008 13:32:39 -0300, Paul McGuire <[EMAIL PROTECTED]> escribió: > Here's a more general version of your testing code, to detect *any* > diamond multiple inheritance (using your sample classes). > > for cls in (A,B,C,D): > seen = set() > try: > bases = cls.__bases__ >

Re: php vs python

2008-05-25 Thread Lie
On May 22, 3:10 am, notbob <[EMAIL PROTECTED]> wrote: > I'm not posting this just to initiate some religious flame war, though it's > the perfect subject to do so.  No, I actaully want some serious advice about > these two languages and since I think usenet is the best arena to find it, > here ya'

Beginner question

2008-05-25 Thread howa
Hi, Just want to try mod_python but it is more complicated then I expected... I just followed the tutorial on: http://www.modpython.org/live/mod_python-2.7.8/doc-html/inst-testing.html E.g. URL = http://www.example.com/mptest.py It return ImportError: No module named mptest 1. If I removed

Re: php vs python

2008-05-25 Thread Jerry Stuckle
Lie wrote: On May 22, 12:28 pm, NC <[EMAIL PROTECTED]> wrote: On May 21, 1:10 pm, notbob <[EMAIL PROTECTED]> wrote: So, here's my delimna: I want to start a blog. Yeah, who doesn't. Yet, I want learn the guts of it instead of just booting up some wordwank or whatever. Here's a simple compu

Re: Getting a set of lambda functions

2008-05-25 Thread I V
On Sun, 25 May 2008 13:43:15 +0200, Martin Manns wrote: > I try to get a set of lambda functions that allows me executing each > function code exactly once. Therefore, I would like to modify the set > function to compare the func_code properties (or the lambda functions to > use this property for c

Re: UTF problem?

2008-05-25 Thread Tim Golden
Vesa-Matti Sarenius wrote: I am trying to set up Linux printing via Windows XP and using this HOWTO: http://justin.yackoski.name/winp/ I have one problem. When I send a file via CUPS to the windows spool directory dirwatch.py (http://justin.yackoski.name/winp/dirwatch.txt) dies and gives: Unic

Re: which datastructure for fast sorted insert?

2008-05-25 Thread Rodrigo Lazo
Stefan Behnel <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: >> im writing a webcrawler. >> after visiting a new site i want to store it in alphabetical order. >> >> so obv i want fast insert. i want to delete duplicates too. >> >> which datastructure is best for this? > > Keep the data

Re: php vs python

2008-05-25 Thread Ivan Illarionov
Jerry Stuckle wrote: > Lie wrote: > > On May 22, 12:28 pm, NC <[EMAIL PROTECTED]> wrote: > >> On May 21, 1:10 pm, notbob <[EMAIL PROTECTED]> wrote: > >>> So, here's my delimna: I want to start a blog.  Yeah, who doesn't. > >>> Yet, I want learn the guts of it instead of just booting up some > >>> w

Re: Showing the method's class in expection's traceback

2008-05-25 Thread Gabriel Genellina
En Sun, 25 May 2008 06:15:45 -0300, Duncan Booth <[EMAIL PROTECTED]> escribió: > "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> En Thu, 22 May 2008 07:55:44 -0300, Duncan Booth >> <[EMAIL PROTECTED]> escribió: >>> >>> It might be worth considering an alternative approach here: a >>> formatted ex

Re: php vs python

2008-05-25 Thread Jerry Stuckle
Ivan Illarionov wrote: Jerry Stuckle wrote: Lie wrote: On May 22, 12:28 pm, NC <[EMAIL PROTECTED]> wrote: On May 21, 1:10 pm, notbob <[EMAIL PROTECTED]> wrote: So, here's my delimna: I want to start a blog. Yeah, who doesn't. Yet, I want learn the guts of it instead of just booting up some w

QOTW

2008-05-25 Thread Scott David Daniels
D'Arcy J.M. Cain wrote: Yes! One of the biggest advantages to unit testing is that you never ever deliver the same bug to the client twice. Delivering software with a bug is bad but delivering it with the same bug after it was reported and fixed is calamitous. QOTW for sure. --Scott David D

Re: UTF problem?

2008-05-25 Thread Vesa-Matti Sarenius
In article <[EMAIL PROTECTED]>, Tim Golden wrote: >so it's just possible that one of your filenames has >a non-ascii char in it without your noticing? (Altho' >I'd find that an odd character to include in a filename). There is somewhere since printing worked when I changed the filename completely.

Re: Code correctness, and testing strategies

2008-05-25 Thread Scott David Daniels
Ben Finney wrote: David <[EMAIL PROTECTED]> writes: You need to justify the extra time spent on writing test code. From the perspective of someone who once thought this way, and then dug in and did Behaviour Driven Development, I can tell you the time is entirely justified: by better design, m

Re: UTF problem?

2008-05-25 Thread Stefan Behnel
Vesa-Matti Sarenius wrote: > This did not work. Neither did commenting all print lines. The problem is > somewhere else. As Tim said, the line number that the exception prints would help here. Stefan -- http://mail.python.org/mailman/listinfo/python-list

RE: where do I begin with web programming in python?

2008-05-25 Thread Dutton, Sam
This doesn't really answer your question, but you might want to consider Google App Engine. http://code.google.com/appengine/ Sam Dutton SAM DUTTON SENIOR SITE DEVELOPER 200 GRAY'S INN ROAD LONDON WC1X 8XZ UNITED KINGDOM T +44 (0)20 7430 4496 F E [EMAIL PROTECTED] WWW.ITN.CO.UK P Plea

Unicode lists and join (python 2.2.3)

2008-05-25 Thread nkarkhan
Hello, I have a list of strings, some of the strings might be unicode. I am trying to a .join operation on the list and the .join raises a unicode exception. I am looking for ways to get around this. I would like to get a unicode string out of the list with all string elements seperated by '\n' #!

Re: UTF problem?

2008-05-25 Thread Vesa-Matti Sarenius
In article <[EMAIL PROTECTED]>, Stefan Behnel wrote: >Vesa-Matti Sarenius wrote: >> This did not work. Neither did commenting all print lines. The problem is >> somewhere else. > >As Tim said, the line number that the exception prints would help here. See my followup... -- Vesa-Matti Sarenius,

Re: UTF problem?

2008-05-25 Thread Vesa-Matti Sarenius
In article <[EMAIL PROTECTED]>, Vesa-Matti Sarenius wrote: >In article <[EMAIL PROTECTED]>, Tim Golden wrote: >>so it's just possible that one of your filenames has >>a non-ascii char in it without your noticing? (Altho' >>I'd find that an odd character to include in a filename). > >There is somewh

set partition question

2008-05-25 Thread pball . benetech
dear pythonistas, So imagine that we have a set of sets S. If we pick arbitrarily one set, s0, what are all the combinations of other sets in S which when combined by set operations result in s0? s0 = set([1]) s1 = set([1,2]) s2 = set([2]) S = set([s0,s1,s2]) one answer we're searching for is s0

22.800000 and a 1 on the end!!??

2008-05-25 Thread notnorwegian
>>> x = 5 >>> x /= 2 >>> x 2 >>> x *=11.4 >>> x 22.801 ok where does the 1 in the come from? -- http://mail.python.org/mailman/listinfo/python-list

Re: 22.800000 and a 1 on the end!!??

2008-05-25 Thread Fuzzyman
On May 25, 8:58 pm, [EMAIL PROTECTED] wrote: > >>> x = 5 > >>> x /= 2 > >>> x > 2 > >>> x *=11.4 > >>> x > > 22.801 > > ok where does the 1 in the come from? Floating point arithmetic. Michael Foord http://www.ironpythoninaction.com/ -- http://mail.python.org/mailman/listinfo/python-l

Re: 22.800000 and a 1 on the end!!??

2008-05-25 Thread Johannes Bauer
[EMAIL PROTECTED] schrieb: ok where does the 1 in the come from? Conversion to floating point values, which have no precise representation for all numbers that have such in the decimal system. Read more on http://en.wikipedia.org/wiki/IEEE_754-1985 Regards, Johannes -- "Wer etwas kritisie

Re: Unicode lists and join (python 2.2.3)

2008-05-25 Thread Martin v. Löwis
> x = [u"\xeeabc2:xyz", u"abc3:123"] > u = "\xe7abc" u is not a Unicode string. > x.append("%s:%s" % ("xfasfs", u)) so what you append is not a Unicode string, either. > x.append(u"Hello:afddfdsfa") > > y = u'\n'.join(x) As a consequence, .join tries to convert the byte st

Re: which datastructure for fast sorted insert?

2008-05-25 Thread I V
On Sun, 25 May 2008 13:05:31 -0300, Gabriel Genellina wrote: > Use a list, and the bisect module to keep it sorted: That's worth doing if you need the data to be sorted after each insert. If the OP just needs the data to be sorted at the end, using a data structure with fast inserts (like a set)

Re: set partition question

2008-05-25 Thread Martin v. Löwis
> s0 = set([1]) > s1 = set([1,2]) > s2 = set([2]) > S = set([s0,s1,s2]) > one answer we're searching for is s0 = s1 - s2 > > There may be arbitrarily many set elements (denoted by integers > 1,2,3,...) and arbitrarily many combinations of the elements composing > the sets s_i (s0, s1, ...). We can

Re: 22.800000 and a 1 on the end!!??

2008-05-25 Thread Martin v. Löwis
> ok where does the 1 in the come from? http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: set partition question

2008-05-25 Thread pball . benetech
On May 25, 1:13 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > We can use any operation or function which > > takes and returns sets. > > I think the problem is significantly underspecified. It would be a more > interesting problem if there was a restriction to a few selected set > operations

Re: 22.800000 and a 1 on the end!!??

2008-05-25 Thread Qwerty Maniac
Like what others said, use the Decimal class to avoid this. from decimal import Decimal x=Decimal(5) x/=2 x*=Decimal("11.4") print x # 28.50 On Mon, May 26, 2008 at 1:28 AM, <[EMAIL PROTECTED]> wrote: > >>> x = 5 > >>> x /= 2 > >>> x > 2 > >>> x *=11.4 > >>> x > 22.801 > > ok where d

Re: php vs python

2008-05-25 Thread NC
On May 25, 11:46 am, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > > If the OP wants to learn the guts of the blog or to implement > the blog from scratch, Python/Django would be a better choice > than PHP. The reason is that he can reuse and customize existing > high quality components for all thes

Re: set partition question

2008-05-25 Thread Arnaud Delobelle
[EMAIL PROTECTED] writes: > dear pythonistas, > > So imagine that we have a set of sets S. If we pick arbitrarily one > set, s0, what are all the combinations of other sets in S which when > combined by set operations result in s0? > > s0 = set([1]) > s1 = set([1,2]) > s2 = set([2]) > S = set([s0,

Re: Code correctness, and testing strategies

2008-05-25 Thread Aahz
In article <[EMAIL PROTECTED]>, David <[EMAIL PROTECTED]> wrote: > >Seriously, 10 hours of testing for code developed in 10 hours? What >kind of environment do you write code for? This may be practical for >large companies with hordes of full-time testing & QA staff, but not >for small companies w

Discount, EDhardy, 10Deep, Bape, COOGI, GGG, Rich Yung, Designers Hoodies, etc

2008-05-25 Thread m13799684969
Brand Jacket : Dsquared Jacket, Prada Jacket, Armani Jacket, Ralph Lauren Jacket, China supply Discount Coat : Burberry Coat, Helen Coat, A&F Coat, Designer Hoodies : LRG hoody, Stussy Hoody, COOGI hoody, Chanel Hoody, GGG hoody, Bape hoody, 10Deep hoodies, Rich Yung Hoodies, Brand Belt China Sale

Re: Getting a set of lambda functions

2008-05-25 Thread bearophileHUGS
I V: > You might instead want to >wrap the lambdas in an object that will do the comparison you want: This looks very nice, I haven't tried it yet, but if it works well then it may deserve to be stored in the cookbook, or better, it may become the built-in behavior of hashing functions. Bye, bear

Re: raising an exception when multiple inheritance involves same baseThank

2008-05-25 Thread Scott David Daniels
Here are some tweaks on both bits of code: Paul McGuire wrote: On May 25, 8:37 am, Michael Hines <[EMAIL PROTECTED]> wrote: ... m = False for b in bases : if hasattr(b, '__mro__'): for bb in b.__mro__ : if bb == MetaHocObject.ho : if m == True:

Re: Code correctness, and testing strategies

2008-05-25 Thread David
> > You must have poor project management/tracking. You WILL pay the cost > of testing, the only question is when. The when does have an impact on > other aspects of the development process. > > Speaking as someone who started in my current job four years ago as the > third developer in a five-pe

  1   2   >