Re: set partition question

2008-05-25 Thread pball . benetech
On May 25, 10:41 pm, [EMAIL PROTECTED] wrote: > So, basically, V = (v_1, v_2, ... , v_{k-1}, v_k) can be regarded as > an abstract, k-dimensional vector, right? Yes. > If I understand your revised problem statement correctly, what you > really want to do is build a graph of these vectors, where

Re: PYQT- How to prevent a dialog being resized in qtdesigner

2008-05-25 Thread Alex Gusarov
There is no simple way to do it. But it seems to be a meaningless - resizing dialog in Designer is equal to changing its geometry. On Mon, May 26, 2008 at 9:30 AM, bbmerong <[EMAIL PROTECTED]> wrote: > I have a question about qtdesigner. > > I'd like to know how to prevent a dialog being resized

Re: set partition question

2008-05-25 Thread miller . paul . w
On May 25, 11:40 pm, [EMAIL PROTECTED] wrote: > This is a problem in statistical estimation. Given n records made up > of k variables, define a cell as the point in the cartesian product of > v_1 * v_2 * ... * v_k. I want to apply an estimator on the data in > each cell. So, basically, V = (v_1,

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

2008-05-25 Thread Patrick Mullen
Here is a quick, ugly way you can easily hide data, although persistent clients can still bypass it. x.__dict__ is ugly, though not any uglier than x.__Ugly__Internal__Variable__Do__Not__Set Another option would be to use another structure, such as a dictionary or list, and store variables in the

Re: Why Turn "Print" into "Print()"????

2008-05-25 Thread Gabriel Genellina
En Mon, 26 May 2008 02:06:02 -0300, Prisoner at War <[EMAIL PROTECTED]> escribió: > Might you have any idea, BTW, whether the upcoming "Head First > Programming" from O'Reilly, coming in August, will cover Python 3?? > Unlikely, right? Unless maybe if that guy Vern Ceder (the author) is > active

Re: Why Turn "Print" into "Print()"????

2008-05-25 Thread Prisoner at War
On May 25, 8:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > See http://www.python.org/dev/peps/pep-3105/ > That should answer all your questions. Hey, thanks, I missed that one! Not that I understand the rationale given (iman00b), but oh well, so it looks like a real function now.

Re: Performance of Python builtins

2008-05-25 Thread miller . paul . w
On May 25, 11:05 pm, Benjamin <[EMAIL PROTECTED]> wrote: > http://wiki.python.org/moin/TimeComplexityis a start. Awesome. That's pretty much what I was after! -- http://mail.python.org/mailman/listinfo/python-list

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

2008-05-25 Thread Russ P.
On May 25, 2:32 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: > On 24 Mai, 15:58, Ben Finney <[EMAIL PROTECTED]> > wrote: > > > Sh4wn <[EMAIL PROTECTED]> writes: > > > first, python is one of my fav languages, and i'll definitely keep > > > developing with it. But, there's 1 one thing what I -really

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

2008-05-25 Thread Patrick Mullen
There are certainly situations where data hiding is useful and perhaps a wanted feature, but there has to be at least one place where I can use what I want when I want to with some high and mighty designer telling me what I should and shouldn't access. One of the reasons they have data hiding in s

Re: Beginner question

2008-05-25 Thread Graham Dumpleton
On May 26, 4:13 am, howa <[EMAIL PROTECTED]> wrote: > 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 > > E.g. > > URL =http://www.example.com/mptest.p

Re: Unhandled exceptions checking

2008-05-25 Thread Yosifov Pavel
On 24 май, 12:58, bukzor <[EMAIL PROTECTED]> wrote: > On May 23, 6:31 pm, Yosifov Pavel <[EMAIL PROTECTED]> wrote: > > > Does somebody know existent tool for checking unhandled exceptions? > > Like in Java when method throws exception but in code using this > > method, try...catch is missed. May be

Re: set partition question

2008-05-25 Thread pball . benetech
On May 25, 7:46 pm, [EMAIL PROTECTED] wrote: > > I think this problem is related to integer partitioning, but it's not > > If, by "integer partitioning," you mean the "subset sum > problem" (given a finite set S of integers, does S contain a subset > which sums up to some given integer k?), then y

Re: set partition question

2008-05-25 Thread Martin v. Löwis
> There may be arbitrarily many set elements (denoted by integers > 1,2,3,...), arbitrarily many combinations of the elements composing > the sets s_i (s0, s1, ...). We can use any of python's set operations > or combination of those operations. That still allows for trivial solutions: Given s0,

Re: php vs python

2008-05-25 Thread Guillaume Bog
On Mon, May 26, 2008 at 8:12 AM, Jerry Stuckle <[EMAIL PROTECTED]> wrote: > Ivan Illarionov wrote: > >> On Sun, 25 May 2008 17:09:43 -0400, Jerry Stuckle wrote: >> >>> Not at all. I do it every day. >>> >>> And BTW - yes, I write Python, also. But I find I can write better, >>> faster code in PH

Re: blogs, longbets.org, and education of sociology

2008-05-25 Thread Lew
[EMAIL PROTECTED] wrote: For about the past 10 years, i [sic] have been saying things like ... fart ignorant ..., often in a irresponsible and carefree way. ... Some of these beer drinking f**kheads are simply being a asshole, ... vandalism. (the tech geekers use in-group slang for this:

Re: UTF problem?

2008-05-25 Thread Vesa-Matti Sarenius
In article <[EMAIL PROTECTED]>, Dennis Lee Bieber wrote: >(Vesa-Matti Sarenius) declaimed the following in comp.lang.python: > And what reported the file not found -- some line of the Python >script, or a spawned shell (since the line you point out is just >creating a command to be executed a

Re: blogs, longbets.org, and education of sociology

2008-05-25 Thread Joshua Cranmer
[EMAIL PROTECTED] wrote: For about the past 10 years, i have been concerned in the programing community's level of education in social issues. [ Adjusts killfile as necessary. ] I have found that recently, a news that would be of interest to programers. There was a bet at longbets.org (run b

Re: Performance of Python builtins

2008-05-25 Thread Benjamin
On May 25, 6:19 pm, [EMAIL PROTECTED] wrote: > Is there any place outside the actual C source for Python that has > information about the performance of Python's built-in operations? For > example, I'd *expect* list.append to be O(1), and I hope that list[i] > is O(1), but I don't really know that

Re: php vs python

2008-05-25 Thread I V
On Sun, 25 May 2008 21:41:09 -0400, Jerry Stuckle wrote: > The the good programmers are able to adapt to the language and make the > most of whatever language they're using. The result is good code. OTOH, > poor programmers I have known have found all kinds of excuses - from the > language itself

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

2008-05-25 Thread miller . paul . w
On May 24, 9:41 am, Sh4wn <[EMAIL PROTECTED]> wrote: > Python advertises himself as a full OOP language, but why does it miss > one of the basic principles of OOP? Will it ever be added to python? Others have already answered this directly, but I'd like to mention that languages I know of which

Re: Organizing a Python project

2008-05-25 Thread Gabriel Genellina
En Sun, 25 May 2008 19:46:50 -0300, Casey McGinty <[EMAIL PROTECTED]> escribió: > On Sat, May 24, 2008 at 2:11 PM, Gabriel Genellina <[EMAIL PROTECTED]> > wrote: > >> > 2. In the top of your package directory it is typical to have a module >> name >> > '_package.py'. This is ideally where the main

Re: set partition question

2008-05-25 Thread miller . paul . w
On May 25, 3:51 pm, [EMAIL PROTECTED] wrote: > dear pythonistas, > > I think this problem is related to integer partitioning, but it's not > quite the same. The range of answers has a little combinatorial > explosion problem as S gains new members. In my problem, len(S) is > usually on the order of

Re: which datastructure for fast sorted insert?

2008-05-25 Thread I V
On Sun, 25 May 2008 18:42:06 -0700, notnorwegian wrote: > def scrapeSites(startAddress): > site = startAddress > sites = set() > iterator = iter(sites) > pos = 0 > while pos < 10:#len(sites): > newsites = scrapeSite(site) > joinSets(sites, newsites) You change t

PYQT- How to prevent a dialog being resized in qtdesigner

2008-05-25 Thread bbmerong
I have a question about qtdesigner. I'd like to know how to prevent a dialog being resized in qtdesigner. I'll wait for your answer. Then, Thank you in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of Python builtins

2008-05-25 Thread miller . paul . w
On May 25, 9:43 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | Is there any place outside the actual C source for Python that has > | information about the performance of Python's built-in operations? > > Unfortunately no.  Guido d

Re: which datastructure for fast sorted insert?

2008-05-25 Thread Gabriel Genellina
En Sun, 25 May 2008 22:42:06 -0300, <[EMAIL PROTECTED]> escribió: > def joinSets(set1, set2): > for i in set2: > set1.add(i) > return set1 Use the | operator, or |= > Traceback (most recent call last): > File "C:/Python25/Progs/WebCrawler/spider2.py", line 47, in > x = scr

jkl

2008-05-25 Thread bbmerong
jll -- http://mail.python.org/mailman/listinfo/python-list

Re: which datastructure for fast sorted insert?

2008-05-25 Thread sturlamolden
On May 25, 8:02 pm, Rodrigo Lazo <[EMAIL PROTECTED]> wrote: > what about heapq for sorting? Heap is the data structure to use for 'fast (nearly) sorted inserts'. But heapq do not support (as far as I know) deletion of duplicates. But a custom heap class coud do that of course. -- http://mail.pyt

Re: which datastructure for fast sorted insert?

2008-05-25 Thread notnorwegian
Traceback (most recent call last): File "C:/Python25/Progs/WebCrawler/spider2.py", line 47, in x = scrapeSites("http://www.yahoo.com";) File "C:/Python25/Progs/WebCrawler/spider2.py", line 31, in scrapeSites site = iterator.next() RuntimeError: Set changed size during iteration def j

Re: php vs python

2008-05-25 Thread Jerry Stuckle
Ivan Illarionov wrote: On Sun, 25 May 2008 20:53:28 -0400, Jerry Stuckle wrote: Ivan Illarionov wrote: Jerry Stuckle wrote: As I've said before - good programmers can write good code in any language. Yes, they can. But it may be harder to do for them in one language and easier in another.

Re: Performance of Python builtins

2008-05-25 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Is there any place outside the actual C source for Python that has | information about the performance of Python's built-in operations? Unfortunately no. Guido does not want to put guarantees in the language definition, so there is

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

2008-05-25 Thread Terry Reedy
"Joe P. Cool" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Actually it is very useful to be able to distinguish | between inside and outside. Which Python allows one to do. | This is obvious for real world things e.g. your | TV. Nobody likes to open the rear cover to switch th

Re: Getting a set of lambda functions

2008-05-25 Thread John Nagle
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 property for comparison). (The reason is that th

Re: php vs python

2008-05-25 Thread Ivan Illarionov
On Sun, 25 May 2008 20:53:28 -0400, Jerry Stuckle wrote: > Ivan Illarionov wrote: >> Jerry Stuckle wrote: >> >>> As I've said before - good programmers can write good code in any >>> language. >> >> Yes, they can. But it may be harder to do for them in one language and >> easier in another. >>

Re: Getting a set of lambda functions

2008-05-25 Thread Terry Reedy
"Martin Manns" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On Sun, 25 May 2008 14:39:28 -0700 (PDT) | [EMAIL PROTECTED] wrote: | | > This may have some bugs left, but it looks a bit better: | [...] | > self._hash = hash(self._func.func_code) ^ \ | >

Re: which datastructure for fast sorted insert?

2008-05-25 Thread notnorwegian
On 26 Maj, 03:04, [EMAIL PROTECTED] wrote: > On 26 Maj, 01:30, I V <[EMAIL PROTECTED]> wrote: > > > > > On Sun, 25 May 2008 15:49:16 -0700, notnorwegian wrote: > > > i meant like set[pos], not iterate but access a specific position in the > > > set. > > > If you need to access arbitrary elements, u

Re: which datastructure for fast sorted insert?

2008-05-25 Thread notnorwegian
On 26 Maj, 01:30, I V <[EMAIL PROTECTED]> wrote: > On Sun, 25 May 2008 15:49:16 -0700, notnorwegian wrote: > > i meant like set[pos], not iterate but access a specific position in the > > set. > > If you need to access arbitrary elements, use a list instead of a set > (but you'll get slower inserts

Re: php vs python

2008-05-25 Thread Jerry Stuckle
Ivan Illarionov wrote: Jerry Stuckle wrote: As I've said before - good programmers can write good code in any language. Yes, they can. But it may be harder to do for them in one language and easier in another. Ivan Not for a good programmer it isn't. I've known a few good programmers i

Re: php vs python

2008-05-25 Thread Ivan Illarionov
Jerry Stuckle wrote: > As I've said before - good programmers can write good code in any > language. Yes, they can. But it may be harder to do for them in one language and easier in another. Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a set of lambda functions

2008-05-25 Thread Terry Reedy
"I V" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | 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 I think it worth the reminder that Python has lambda *expressions* that result in function objects

Re: Why Turn "Print" into "Print()"????

2008-05-25 Thread [EMAIL PROTECTED]
On May 25, 8:26 pm, Prisoner at War <[EMAIL PROTECTED]> wrote: > Hi, your friendly neighborhood n00b here, just wondering why on earth > the Py3K folks want to mess with a simple thing like the "print" > "command" (is that what it's called, a command?), turning it into > "print()"...I mean, what's

Re: blogs, longbets.org, and education of sociology

2008-05-25 Thread sln
Your opinion of yourself is only surpased by your monumental display of mastery of the English language. sln On Sun, 25 May 2008 16:25:33 -0700 (PDT), "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >For about the past 10 years, i have been concerned in the programing >community's level of educ

Why Turn "Print" into "Print()"????

2008-05-25 Thread Prisoner at War
Hi, your friendly neighborhood n00b here, just wondering why on earth the Py3K folks want to mess with a simple thing like the "print" "command" (is that what it's called, a command?), turning it into "print()"...I mean, what's the point, exactly?? To look like a more "traditional" computer-langu

Re: Pinging a machine from python

2008-05-25 Thread Zerge
On May 25, 11:13 am, Prasanth <[EMAIL PROTECTED]> wrote: > 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. Import OS ip=192.168.1.1 pingtext

Re: php vs python

2008-05-25 Thread Jerry Stuckle
Ivan Illarionov wrote: On Sun, 25 May 2008 16:23:12 -0700, NC wrote: I didn't say that it's not possible to write good code in PHP, Indeed you didn't. You did, however, say that development in Python/ Django is inherently faster than development in PHP (your exact words were, "2 man/year in P

Re: Storing a function

2008-05-25 Thread Gabriel Genellina
En Sun, 25 May 2008 18:00:12 -0300, Kuros <[EMAIL PROTECTED]> escribió: > Hi, > Hoping I could get some help with a python question. > > I want to be able to store the code for a single function in a .py file, > such as: > > def test(): > print "Test" > > From within a Python script, I would l

Re: php vs python

2008-05-25 Thread Jerry Stuckle
Ivan Illarionov wrote: On Sun, 25 May 2008 17:09:43 -0400, Jerry Stuckle wrote: Not at all. I do it every day. And BTW - yes, I write Python, also. But I find I can write better, faster code in PHP. I find I can write better code in Python. Maybe it's just a matter of personal preference?

Re: which datastructure for fast sorted insert?

2008-05-25 Thread miller . paul . w
On May 25, 2:37 am, [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? I think you ought to re-examine your requirements.

Re: php vs python

2008-05-25 Thread Ivan Illarionov
On Sun, 25 May 2008 16:23:12 -0700, NC wrote: >> I didn't say that it's not possible to write good code in PHP, > > Indeed you didn't. You did, however, say that development in Python/ > Django is inherently faster than development in PHP (your exact words > were, "2 man/year in PHP == 2 man/wee

Re: Performance of Python builtins

2008-05-25 Thread miller . paul . w
On May 25, 7:35 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: Thanks for your reply. I guess I'll have to go source diving to truly answer the question. > "You can fix your Python program's performance problems by rewriting > it in C" is not that convincing an answ

Re: Getting a set of lambda functions

2008-05-25 Thread Martin Manns
On Sun, 25 May 2008 14:39:28 -0700 (PDT) [EMAIL PROTECTED] wrote: > This may have some bugs left, but it looks a bit better: [...] > self._hash = hash(self._func.func_code) ^ \ > hash(tuple(signature[0]) + tuple(signature[1:3])) > def __eq__(self, other): >

Re: Performance of Python builtins

2008-05-25 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Is there any place outside the actual C source for Python that has > information about the performance of Python's built-in operations? Really, just the source code and the general culture. It's not in the docs; that would be a pretty rare thing. > For example, I'd *e

Re: which datastructure for fast sorted insert?

2008-05-25 Thread I V
On Sun, 25 May 2008 15:49:16 -0700, notnorwegian wrote: > i meant like set[pos], not iterate but access a specific position in the > set. If you need to access arbitrary elements, use a list instead of a set (but you'll get slower inserts). OTOH, if you just need to be able to get the next item

Re: Getting a set of lambda functions

2008-05-25 Thread Denis Kasak
Scott David Daniels wrote: Denis Kasak wrote: ... spam = [] for i in range(10): ... spam.append(lambda: i) spam[0]() 9 spam[1]() 9 Manually creating the lambdas and appending them to a list works as expected, naturally; I don't see a good reason why it wouldn't work with a loop. Am I mis

blogs, longbets.org, and education of sociology

2008-05-25 Thread [EMAIL PROTECTED]
For about the past 10 years, i have been concerned in the programing community's level of education in social issues. I have found that recently, a news that would be of interest to programers. There was a bet at longbets.org (run by Long Now Foundation) regarding the importance of blogs. The bet

Re: php vs python

2008-05-25 Thread NC
On May 25, 1:55 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Sun, 25 May 2008 13:28:25 -0700, NC wrote: > > > A quick look at the revision log: > > > http://byteflow.su/log/ > > > reveals that the initial commit of 60 or so files has been done > > on 08/14/07 (10 months ago), a second develo

Performance of Python builtins

2008-05-25 Thread miller . paul . w
Is there any place outside the actual C source for Python that has information about the performance of Python's built-in operations? For example, I'd *expect* list.append to be O(1), and I hope that list[i] is O(1), but I don't really know that for sure, since it would depend a lot on the internal

Re: Getting a set of lambda functions

2008-05-25 Thread Scott David Daniels
Denis Kasak wrote: ... spam = [] for i in range(10): ... spam.append(lambda: i) spam[0]() 9 spam[1]() 9 Manually creating the lambdas and appending them to a list works as expected, naturally; I don't see a good reason why it wouldn't work with a loop. Am I missing something? Yes, you a

Re: which datastructure for fast sorted insert?

2008-05-25 Thread notnorwegian
On May 25, 9:32 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > 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

Re: Organizing a Python project

2008-05-25 Thread Casey McGinty
On Sat, May 24, 2008 at 2:11 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > 2. In the top of your package directory it is typical to have a module > name > > '_package.py'. This is ideally where the main command line entry point > for > > the package code should be placed. > > Why the unders

Re: Getting a set of lambda functions

2008-05-25 Thread Denis Kasak
On Sun, May 25, 2008 at 1:43 PM, Martin Manns <[EMAIL PROTECTED]> 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

Re: Getting a set of lambda functions

2008-05-25 Thread Denis Kasak
On Sun, May 25, 2008 at 1:43 PM, Martin Manns <[EMAIL PROTECTED]> 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 t

Re: Code correctness, and testing strategies

2008-05-25 Thread Scott David Daniels
David wrote: It was an interesting exercise, and I'm encouraged to try it further. Yes, The developed code is missing an overview, but this is an example implementing something we all understand a "stack". The layout is a little short on vertical whitespace, but I'm presuming you do that for

Re: Code correctness, and testing strategies

2008-05-25 Thread Paul Rubin
[EMAIL PROTECTED] (Aahz) writes: > 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. Well, let's say you used TDD and your program has 5000 tests. One might r

Re: finding icons for Apps

2008-05-25 Thread Casey McGinty
http://art.gnome.org/ http://www.gnome-look.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Code correctness, and testing strategies

2008-05-25 Thread Matthew Woodcraft
David <[EMAIL PROTECTED]> wrote: > Might be a difference in project size/complexity then, rather than > company size. Most of my works projects are fairly small (a few > thousand lines each), very modular, and each is usually written and > maintained by one developer. A lot of the programs will be

Re: Getting a set of lambda functions

2008-05-25 Thread bearophileHUGS
This may have some bugs left, but it looks a bit better: from inspect import getargspec class HashableFunction(object): """Class that can be used to wrap functions, to allow their hashing, for example to create a set of unique functions. >>> func_strings = ['x', 'x+1', 'x+2', 'x']

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

2008-05-25 Thread Joe P. Cool
On 24 Mai, 15:58, Ben Finney <[EMAIL PROTECTED]> wrote: > Sh4wn <[EMAIL PROTECTED]> writes: > > first, python is one of my fav languages, and i'll definitely keep > > developing with it. But, there's 1 one thing what I -really- miss: > > data hiding. I know member vars are private when you prefix t

Re: php vs python

2008-05-25 Thread Ivan Illarionov
On Sun, 25 May 2008 17:09:43 -0400, Jerry Stuckle wrote: > Not at all. I do it every day. > > And BTW - yes, I write Python, also. But I find I can write better, > faster code in PHP. I find I can write better code in Python. Maybe it's just a matter of personal preference? > Do you write PHP

Re: php vs python

2008-05-25 Thread Jerry Stuckle
Ivan Illarionov wrote: On Sun, 25 May 2008 13:28:25 -0700, NC wrote: [...] A quick look at the revision log: http://byteflow.su/log/ reveals that the initial commit of 60 or so files has been done on 08/14/07 (10 months ago), a second developer came on board 12/01/07 (seven+ months ago), a thi

Storing a function

2008-05-25 Thread Kuros
Hi, Hoping I could get some help with a python question. I want to be able to store the code for a single function in a .py file, such as: def test(): print "Test" >From within a Python script, I would like to be able to get a handler so I can do something like: handler.test() I want to be

Re: php vs python

2008-05-25 Thread Ivan Illarionov
On Sun, 25 May 2008 13:28:25 -0700, NC wrote: [...] > A quick look at the revision log: > > http://byteflow.su/log/ > > reveals that the initial commit of 60 or so files has been done on > 08/14/07 > (10 months ago), a second developer came on board 12/01/07 (seven+ > months ago), > a third one,

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

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: 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

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: 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

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: 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: 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: 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 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 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: 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: 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: 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: 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

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

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

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

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,

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: 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

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: 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 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.

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: 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

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 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

  1   2   >