Re: Is this a good idea or a waste of time?

2006-08-28 Thread Antoon Pardon
On 2006-08-29, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > At Tuesday 29/8/2006 02:45, Antoon Pardon wrote: > >> >>That may be true. But one may wonder if this is a failing of the >> >>programmer or a failing of the language that doesn't support >> >>such things. >> > >> > In any case, I don't s

Re: Is this a good idea or a waste of time?

2006-08-28 Thread Antoon Pardon
On 2006-08-29, Simon Forman <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> On 2006-08-28, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> > Antoon Pardon wrote: >> >> There seem to be enough problems that work with ints but not with >> >> floats. In such a case enforcing that the number you w

Re: unit test for a printing method

2006-08-28 Thread Marco Wahl
> [OP] What is the proper way to test (using unit test) a method that print > information? > [...] Fredrik Lundh <[EMAIL PROTECTED]> writes: > > Scott David Daniels wrote: > >> For silly module myprog.py: >> def A(s): >> print '---'+s+'---' >> in test_myprog.py: >> import unitte

Re: Is this a good idea or a waste of time?

2006-08-28 Thread Gabriel Genellina
At Tuesday 29/8/2006 02:45, Antoon Pardon wrote: >>That may be true. But one may wonder if this is a failing of the >>programmer or a failing of the language that doesn't support >>such things. > > In any case, I don't see how this supports the original claim that > strict type checking input pa

Re: [ANN] NumPy 1.0b4 now available

2006-08-28 Thread Bruce Who
Hi, Travis I can pack my scripts into an executable with py2exe, but errors occur once it runs: No scipy-style subpackage 'random' found in D:\test\dist\numpy. Ignoring: No module named info import core -> failed: No module named _internal import lib -> failed: 'module' object has no attribute '_

RE: Operator Overloading Basics

2006-08-28 Thread Mohit Bhatt
Thanks a lot Fredrik and Tim for your help. Cheers, Mohit -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a good idea or a waste of time?

2006-08-28 Thread Antoon Pardon
On 2006-08-29, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > At Tuesday 29/8/2006 01:28, Antoon Pardon wrote: > >> > Antoon Pardon wrote: >> >> There seem to be enough problems that work with ints but not with >> >> floats. In such a case enforcing that the number you work with >> >> is indeed an

Re: Is this a good idea or a waste of time?

2006-08-28 Thread Simon Forman
Antoon Pardon wrote: > On 2006-08-28, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Antoon Pardon wrote: > >> There seem to be enough problems that work with ints but not with > >> floats. In such a case enforcing that the number you work with > >> is indeed an int seems fully appropiate. > > >

Re: eval() woes

2006-08-28 Thread Simon Forman
rdrink wrote: > Ok, maybe now I can make some more sense of this, with an example of > real code (sorry if it's a bit dense): > This is the basic function... > > def equate(parts,new_eq): > > oL = int(parts[0]) > iL = int(parts[1]) > iR = int(parts[2]) > oR = int(parts[3]) >

Re: Is this a good idea or a waste of time?

2006-08-28 Thread Gabriel Genellina
At Tuesday 29/8/2006 01:28, Antoon Pardon wrote: > Antoon Pardon wrote: >> There seem to be enough problems that work with ints but not with >> floats. In such a case enforcing that the number you work with >> is indeed an int seems fully appropiate. > > I've _never_ seen a case where enforcing

Re: eval() woes

2006-08-28 Thread Simon Forman
rdrink wrote: > Hey Simon, Thanks for the reply. > > Simon Forman wrote: > > You must be doing something weird, that equation works for me: > > Try posting the minimal code example that causes the error and the > > full, exact traceback that you get. > > I appreciate the offer... but at this point

Re: eval() woes

2006-08-28 Thread Gabriel Genellina
At Tuesday 29/8/2006 01:13, rdrink wrote: File "the_farmer2.py", line 112, in equate iL = int(parts[1]) ValueError: invalid literal for int(): - So parts[1] is '-'. Try adding a few print statements; I'd add a try/except around those lines, printing parts, I bet it's not what you expect

Re: eval() woes

2006-08-28 Thread John McMonagle
On Mon, 2006-08-28 at 21:13 -0700, rdrink wrote: > > (BTW, as a footnote: For each of the above 'equations' the function > equate() was called 500 times... in some cases with the list 'parts' > equaling things like ['0',2','3','0'], so I have no reason to believe > that the problem is with the wa

Re: Is this a good idea or a waste of time?

2006-08-28 Thread Antoon Pardon
On 2006-08-28, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> There seem to be enough problems that work with ints but not with >> floats. In such a case enforcing that the number you work with >> is indeed an int seems fully appropiate. > > I've _never_ seen a case where en

Re: How to let a loop run for a while before checking for break condition?

2006-08-28 Thread Steve Holden
Claudio Grondi wrote: > Sorin Schwimmer wrote: [...] > It doesn't. > > Claudio Sometimes silence is preferable to a concrete response. It takes less time and occupies less bandwidth. regards Steve who should perhaps have followed his own advice -- Steve Holden +44 150 684 7255 +1 8

Re: how to varify if a URL is valid in python?

2006-08-28 Thread Steve Holden
fegge wrote: > what module should i import? > You probably want urllib. If you have the Tools directory in your Python distro you can take a look at the webchecker.py application for an example of how it might be done. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Hol

Re: __str__ for large objects, would not c++ iostream be more efficient

2006-08-28 Thread Gabriel Genellina
At Tuesday 29/8/2006 00:04, alf wrote: is there any way in Python to have iostream like __str__ operator? Define a method writeTo(f) if you want, and instead of: f.write('%s' % obj) use: obj.writeTo(f) Gabriel Genellina Softlab SRL _

Re: Pros/Cons of Turbogears/Rails?

2006-08-28 Thread Steve Holden
Ray wrote: > Paul Boddie wrote: > >>>But at least in most developers' perception, it is (not necessarily in >>>the absolute sense, but perhaps relative to Django or Turbogears). >>>Mind, it doesn't even need to be true, we're talking of perception >>>here. >> >>So actual maturity isn't important w

Re: eval() woes

2006-08-28 Thread rdrink
Ok, maybe now I can make some more sense of this, with an example of real code (sorry if it's a bit dense): This is the basic function... def equate(parts,new_eq): oL = int(parts[0]) iL = int(parts[1]) iR = int(parts[2]) oR = int(parts[3]) oLoL = int(str(o

Re: Desktop Notification/Alerts In Python

2006-08-28 Thread zutesmog
Chaos wrote: > I am looking for ways to have a Desktop Alert, like the one most IM > Messengers have (MSN, AIM) at the lower right above the taskbar. Can > anyone point me to the right resources to use? I am not sure exactly what you are looking for but I assume you are using windows, so I would

Re: M$ windows python libs installed in arbitrary directories forcustomized python distributions

2006-08-28 Thread Steve Holden
alf wrote: > Martin v. Löwis wrote: > >>>it's spelled "Windows installers" >> >>I want to second this. It was me who created the installer, and I don't >>like to see my name abbreviated as M$ (if you think you should write >>out the name of the MSI creator, please say "Martin's installer" :-). >

Re: M$ windows python libs installed in arbitrary directories forcustomized python distributions

2006-08-28 Thread alf
Martin v. Löwis wrote: >>it's spelled "Windows installers" > I want to second this. It was me who created the installer, and I don't > like to see my name abbreviated as M$ (if you think you should write > out the name of the MSI creator, please say "Martin's installer" :-). ok, let me clarify, b

__str__ for large objects, would not c++ iostream be more efficient

2006-08-28 Thread alf
Hi, is there any way in Python to have iostream like __str__ operator? -- alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching for text

2006-08-28 Thread Simon Forman
robinsiebler wrote: > The other thing I failed to mention is that I need to ensure that I > find the fsType *before* I find the next FontName. Given these requirements, I'd formulate the script something like this: f = open(filename) NUM_LINES_BETWEEN = 7 Fo = '/FontName /ACaslonPro-Semibold'

Re: How ahead are you guys in the (Python) real world?

2006-08-28 Thread [EMAIL PROTECTED]
Ray wrote: > > Is it the same in the Python world? What version of Python is used in, > say, Google? Is it even 2.4 yet? Google uses many versions of Python including 2.2, 2.3 and 2.4. Though 2.4 is relatively new. I hope to start introducing Python 2.5 sometime next year. Mid-year is about as

Re: Pros/Cons of Turbogears/Rails?

2006-08-28 Thread Jorge Vargas
On 8/27/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > First, I don't intend this to be a flame war, please. Python > and Ruby are the only two languages I'd willingly work in > (at least amongst common languages), and TurboGears and > Rails seem roughly equivalent. > > I'm much more knowledgab

Re: How ahead are you guys in the (Python) real world?

2006-08-28 Thread Ray
Jorge Vargas wrote: > for ones 2.5 is not consider production code yet so noone should be > running anything on it. same with 1.6. Yes, certainly, in fact in a lot of companies I've worked for the criteria for upgrading is when the Vendor is about to stop supporting it :) But are there many compa

Re: How ahead are you guys in the (Python) real world?

2006-08-28 Thread Jorge Vargas
On 28 Aug 2006 20:13:54 -0700, Ray <[EMAIL PROTECTED]> wrote: > Since I haven't used Python at work, I am using Python 2.5 right now. > However I wonder, how fast are you guys moving from version to version > at work? As an illustration my ex-company just moved to Java 5, which > was released aroun

Re: How ahead are you guys in the (Python) real world?

2006-08-28 Thread skip
Ray> Since I haven't used Python at work, I am using Python 2.5 right Ray> now. However I wonder, how fast are you guys moving from version Ray> to version at work? At my day job (a trading firm) we moved from 2.3 to 2.4 a couple months ago. At home I use whatever's in CVS. For my m

How ahead are you guys in the (Python) real world?

2006-08-28 Thread Ray
Since I haven't used Python at work, I am using Python 2.5 right now. However I wonder, how fast are you guys moving from version to version at work? As an illustration my ex-company just moved to Java 5, which was released around... what, 2-3 years ago? (While I am running Java 6 at home) Is it t

Re: wxPython and Py2exe crashes in "window" mode but not in "console" mode

2006-08-28 Thread Jerry
http://www.heiselman.com/MultiSSH.zip -- http://mail.python.org/mailman/listinfo/python-list

Re: Python web service ...

2006-08-28 Thread Gabriel Genellina
At Monday 28/8/2006 20:45, Nicolas G wrote: If I want to run my program as a web service I need to setup a webserver , am I right ? Whars that difference ? can a webservice be run without a webserver ? Well, a webservice uses HTTP as its transport protocol, so you need an HTTP server, but you

Re: Pros/Cons of Turbogears/Rails?

2006-08-28 Thread Ray
Paul Boddie wrote: > > But at least in most developers' perception, it is (not necessarily in > > the absolute sense, but perhaps relative to Django or Turbogears). > > Mind, it doesn't even need to be true, we're talking of perception > > here. > > So actual maturity isn't important when using a t

SOAPpy question

2006-08-28 Thread Yusnel Rojas
hello ,I'm wondering if SOAPpy doesn't have something to generate a wsdl for a specific application.Let's say, I wrote a web service with SOAPpy, is there any way to generate the wsdl for it.If there aren't can someone give a little example of both. thanks -- http://mail.python.org/mailman/listin

NEED HELP

2006-08-28 Thread mailme . grover
Below is my code, which is kind of virtual and with its help ill use it in my main project. Now what i am looking for is can anybody write all the code inside a class...so that I can reuse it. I am kind of novice...n kind of stuc with that. from Tkinter import * root = Tk() w = Label(root, text=

Re: eval() woes

2006-08-28 Thread rdrink
Hey Simon, Thanks for the reply. Simon Forman wrote: > You must be doing something weird, that equation works for me: > Try posting the minimal code example that causes the error and the > full, exact traceback that you get. I appreciate the offer... but at this point my code is too recursive an

Re: unit test for a printing method

2006-08-28 Thread Gabriel Genellina
At Monday 28/8/2006 12:59, Fredrik Lundh wrote: > What is the proper way to test (using unit test) a method that print > information? > for example: > > def A(s): > print '---'+s+'---' > > and i want to check that A("bla") really print out "---bla---" http://docs.python.org/lib/module-

Re: Searching for text

2006-08-28 Thread Tim Chase
> The other thing I failed to mention is that I need to ensure that I > find the fsType *before* I find the next FontName. found_fontname = False font_search = '/FontName /ACaslonPro-Semibold' type_search = '/FSType 8' for line in file('foo.txt'): if font_search in line: if

Re: Is this a good idea or a waste of time?

2006-08-28 Thread Terry Hancock
asincero wrote: > Would it be considered good form to begin every method or function > with a bunch of asserts checking to see if the parameters are of the > correct type [...] > > This is something I miss from working with more stricter languages > like C++, where the compiler will tell you i

Re: Searching for text

2006-08-28 Thread robinsiebler
The other thing I failed to mention is that I need to ensure that I find the fsType *before* I find the next FontName. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbe question about removing items from one file to another file

2006-08-28 Thread Gabriel Genellina
At Sunday 27/8/2006 18:35, [EMAIL PROTECTED] wrote: (This code don't even compile...!) def simplecsdtoorc(filename): file = open(filename,"r") file is not a good name - hides the builtin type of the same name. Same for dict, list... alllines = file.read_until("") read_until???

Re: Searching for text

2006-08-28 Thread robinsiebler
> You omit what you want to do with the results when you find > them...or what should happen when they both appear on the same > line (though you hint that they're a couple lines apart, you > don't define this as a "this is always the case" sort of scenario) I don't do anything, per se. I just n

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-28 Thread Patrick Maupin
Dieter Maurer wrote: > "Patrick Maupin" <[EMAIL PROTECTED]> writes on 26 Aug 2006 12:51:44 -0700: > > ... > > The only > > problem I personally know of is that the __slots__ aren't inherited, > > "__slots__" *ARE* inherited, although the rules may be a bit > complex. Yes, I didn't write that corr

Re: Searching for text

2006-08-28 Thread Tim Chase
> I want to search the file until I find '/FontName /ACaslonPro-Semibold' > and then jump forward 7 lines where I expect to find '/FSType 8'. I > then want to continue searching from *that* point forward for the next > FontName/FSType pair. Unfortunately, I haven't been able to figure out > how t

Re: Python editor

2006-08-28 Thread Jerry Fleming
Larry Bates wrote: > Jason Jiang wrote: >> Hi, >> >> Could someone recommend a good Python editor? Thanks. >> >> Jason >> >> >> > For just getting started use Idle that comes with Python. > If you are already a user or if you are looking for a more > powerful solution you can use Eclipse (with Pyt

Re: Truly platform-independent DB access in Python?

2006-08-28 Thread Ben Finney
"Boris Duek" <[EMAIL PROTECTED]> writes: > Yes, you excactly got my point. The thing is that I can't rely on > Python 2.5 to be installed soon. > So the only solution for me at this moment is to use jython and from > there use Java JDBC API (sorry :-) Assuming Java is installed on an arbitrary ma

Re: about daemons and IPC

2006-08-28 Thread Gabriel Genellina
At Sunday 27/8/2006 00:01, [EMAIL PROTECTED] wrote: Hey people! For the first time I'm doing a client/server application, and I'm really confused with IPC stuff. I read the fastest method is shared memory, but I tryed mmap and found it tedious for the amount of data I'm handling (which is 30K a

Searching for text

2006-08-28 Thread robinsiebler
I have a batch of files that I am trying to search for specific text in a specific format. Each file contains several items I want to search for. Here is a snippet from the file: ... /FontName /ACaslonPro-Semibold def /FontInfo 7 dict dup begin /Notice (Copyright 2000 Adobe Systems Incorporated.

Re: Anonymous dynamic import

2006-08-28 Thread Maric Michaud
Le lundi 28 août 2006 22:15, Christian Convey a écrit : > I've looked at using imp.load_source() or imp.load_module(), but it looks > to me like all of these polute the global namespace with the names of the > modules I'm importing. Really ? They don't. (there are some quirks in my little function

Re: Python web service ...

2006-08-28 Thread Nicolas G
If I want to run my program as a web service I need to setup a webserver , am I right ? Whars that difference ? can a webservice be run without a webserver ? On 8/29/06, Jorge Vargas <[EMAIL PROTECTED]> wrote: > On 26 Aug 2006 04:07:35 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi fol

Re: naive misuse? (of PyThreadState_SetAsyncExc)

2006-08-28 Thread Tim Peters
[EMAIL PROTECTED] >> The documentation for PyThreadState_SetAsyncExc says "To prevent naive >> misuse, you must write your own C extension to call this". Anyone care >> to list a few examples of such naive misuse? [and again] > No? I'll take that then as proof that it's impossible to misuse the >

Re: Coding style and else statements

2006-08-28 Thread Bruno Desthuilliers
Sam Pointon a écrit : > Bruno Desthuilliers wrote: > >>foo = lambda thing: thing and thing + 1 or -1 > > > The and ... or trick is buggy (what if thing == -1?) Yes, true - Should be: foo2 = lambda t: t != -1 and (t and t+1 or -1) or 0 > and bad style. Lol. Well, so what about: foo = lambda

Re: Coding style and else statements

2006-08-28 Thread Tal Einat
tobiah wrote: > def foo(thing): > > if thing: > return thing + 1 > else: > return -1 > > def foo(thing): > > if thing: > return thing + 1 > return -1 > > Obviously both do the same thing. The first is > possibly clearer, while the s

Re: Max OSX and Excel

2006-08-28 Thread Kevin Walzer
Johanna Pfalz wrote: > Hi there, > > Does anyone have details on how to drive excel using python 2.4 on OSX? > I've searched the web and have not found anything specific to excel. > > Thanks in advance, > > > Johanna Pfalz > Smithers, BC > > > Try AppScript: http://appscript.sourceforge.net

Re: Max OSX and Excel

2006-08-28 Thread John Machin
Jorge Vargas wrote: > On 8/28/06, Johanna Pfalz <[EMAIL PROTECTED]> wrote: > > To be more specific, I'm interested in reading in certain rows and columns > > from an excel spreadsheet directly without converting the information to a > > text file. I'd also like to be able to write directly to an e

Re: naive misuse? (of PyThreadState_SetAsyncExc)

2006-08-28 Thread johan2sson
[EMAIL PROTECTED] wrote: > The documentation for PyThreadState_SetAsyncExc says "To prevent naive > misuse, you must write your own C extension to call this". Anyone care > to list a few examples of such naive misuse? No? I'll take that then as proof that it's impossible to misuse the function.

Re: Best IDE for Python

2006-08-28 Thread Dr. Pastor
Thank you Sir. I downloaded SPE from the main site. Installed on Windows XP. Regards. Sybren Stuvel wrote: > Dr. Pastor enlightened us with: >> Please advise how to uninstal SPE. > > First you'll have to tell us how you installed it in the first place. > Without that, we can only guess. > > Syb

Re: Coding style and else statements

2006-08-28 Thread Sam Pointon
Bruno Desthuilliers wrote: > foo = lambda thing: thing and thing + 1 or -1 The and ... or trick is buggy (what if thing == -1?) and bad style. If you -do- want a conditional expression, 2.5 provides one: thing + 1 if thing else -1 No subtle logical bugs, and a good deal more obvious. On the top

Re: Max OSX and Excel

2006-08-28 Thread Fredrik Lundh
Johanna Pfalz wrote: > To be more specific, I'm interested in reading in certain rows and columns > from an excel spreadsheet directly without converting the information to a > text file. I'd also like to be able to write directly to an excel > spreadsheet from python. tried http://sourceforge.n

Re: Coding style and else statements

2006-08-28 Thread Bruno Desthuilliers
tobiah a écrit : > def foo(thing): > > if thing: > return thing + 1 > else: > return -1 > > def foo(thing): > > if thing: > return thing + 1 > return -1 > > Obviously both do the same thing. The first is > possibly clearer, while the second is more conci

Re: Max OSX and Excel

2006-08-28 Thread Jorge Vargas
On 8/28/06, Johanna Pfalz <[EMAIL PROTECTED]> wrote: > To be more specific, I'm interested in reading in certain rows and columns > from an excel spreadsheet directly without converting the information to a > text file. I'd also like to be able to write directly to an excel > spreadsheet from pyth

Re: get a line of text from a socket...

2006-08-28 Thread Fredrik Lundh
"KraftDiner" wrote: > What makes asyncore.loop exit? as most other things you ask about, that's explained in the documentation: http://docs.python.org/lib/module-asyncore.html loop(...) Enter a polling loop that terminates after count passes or all open channels have been c

Re: class problem

2006-08-28 Thread Jorge Vargas
On 8/28/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Jorge Vargas wrote: > > > seems like a feature/bug of 2.5, why your learning a language with a > > beta version? > > learning? I'm sorry I though you where the original poster. > > (btw, the "c" in 2.5c1 means *release candidate*, not "beta").

Re: Max OSX and Excel

2006-08-28 Thread Johanna Pfalz
To be more specific, I'm interested in reading in certain rows and columns from an excel spreadsheet directly without converting the information to a text file. I'd also like to be able to write directly to an excel spreadsheet from python. On 8/28/06 3:00 PM, "Jorge Vargas" <[EMAIL PROTECTED]>

Re: class problem

2006-08-28 Thread Fredrik Lundh
Jorge Vargas wrote: > seems like a feature/bug of 2.5, why your learning a language with a > beta version? learning? (btw, the "c" in 2.5c1 means *release candidate*, not "beta"). -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a good idea or a waste of time?

2006-08-28 Thread [EMAIL PROTECTED]
Antoon Pardon wrote: > There seem to be enough problems that work with ints but not with > floats. In such a case enforcing that the number you work with > is indeed an int seems fully appropiate. I've _never_ seen a case where enforcing types in the manner of the OP is appropriate. It fails with

Re: Best IDE for Python

2006-08-28 Thread Dr. Pastor
Please advise how to uninstal SPE. Regards, Dr. Pastor. jelle wrote: > I think SPE is a terrible complete and efficient IDE! > == Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News== http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups

Re: get a line of text from a socket...

2006-08-28 Thread KraftDiner
Bryan Olson wrote: > KraftDiner wrote: > > > Thanks I can't seem to get this example to do anything except sit > > there > > http://docs.python.org/lib/asyncore-example.html > > Yeah, the example code, by itself, will just sit there. > As an example, it should probably include the calls to mak

Re: class problem

2006-08-28 Thread Jorge Vargas
On 8/28/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Duncan Booth wrote: > > > Yes, the first one is a syntax error because you aren't allowed empty > > parentheses in a class statement > > however, > > $ python > Python 2.5c1 /.../ > >>> class foo(): > ... pass > ... > >>> foo > > >>> >

Re: Max OSX and Excel

2006-08-28 Thread Jorge Vargas
On 8/28/06, Johanna Pfalz <[EMAIL PROTECTED]> wrote: > Hi there, > > Does anyone have details on how to drive excel using python 2.4 on OSX? > I've searched the web and have not found anything specific to excel. drive? > > Thanks in advance, > > > Johanna Pfalz > Smithers, BC > > > > -- > http://m

Re: Python web service ...

2006-08-28 Thread Jorge Vargas
On 26 Aug 2006 04:07:35 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi folks, I have accomplished to make a python program that make some > image manipulation to bmp files. > I now want to provide this program as a web service. A user can visit a > site and through a web interface he shou

Re: Coding style and else statements

2006-08-28 Thread Jorge Vargas
On 8/28/06, tobiah <[EMAIL PROTECTED]> wrote: > def foo(thing): > > if thing: > return thing + 1 > else: > return -1 > > def foo(thing): > > if thing: > return thing + 1 > return -1 > > Obviously both do the same thing.

Coding style and else statements

2006-08-28 Thread tobiah
def foo(thing): if thing: return thing + 1 else: return -1 def foo(thing): if thing: return thing + 1 return -1 Obviously both do the same thing. The first is possibly clearer, while the second is more concise. Co

Re: how to varify if a URL is valid in python?

2006-08-28 Thread Jorge Vargas
http://docs.python.org/lib/module-urllib.html On 28 Aug 2006 14:38:13 -0700, fegge <[EMAIL PROTECTED]> wrote: > what module should i import? > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

how to varify if a URL is valid in python?

2006-08-28 Thread fegge
what module should i import? -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a good idea or a waste of time?

2006-08-28 Thread Antoon Pardon
On 2006-08-28, Scott David Daniels <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> On 2006-08-25, Simon Forman <[EMAIL PROTECTED]> wrote: >>> ... >>> Generally asserts should be used to "enforce" invariants of your code >>> (as opposed to typechecking), or to check certain things while >>> deb

Re: How to store ASCII encoded python string?

2006-08-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Fredrik Lundh wrote: >> 3) convert the data to Unicode before passing it to the database >> interface, and leave it to the interface to convert it to whatever >> encoding your database uses: >> >> data = ... get encoded string from email ... >> text = data.deco

Re: How to store ASCII encoded python string?

2006-08-28 Thread Jean-Paul Calderone
On 28 Aug 2006 13:51:58 -0700, [EMAIL PROTECTED] wrote: >Fredrik Lundh wrote: >> 3) convert the data to Unicode before passing it to the database >> interface, and leave it to the interface to convert it to whatever >> encoding your database uses: >> >> data = ... get encoded string from email

Re: Twisted server and protocol question

2006-08-28 Thread Simon Forman
Benry wrote: > Hi guys. I hope I can discuss Twisted here. If not, direct me to the > correct place please. Twisted mailing list: http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python ;-) ~Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: How to store ASCII encoded python string?

2006-08-28 Thread micahc
Fredrik Lundh wrote: > 3) convert the data to Unicode before passing it to the database > interface, and leave it to the interface to convert it to whatever > encoding your database uses: > > data = ... get encoded string from email ... > text = data.decode("iso-8859-1") > ... write

Re: Python web service ...

2006-08-28 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi folks, I have accomplished to make a python program that make some > image manipulation to bmp files. > I now want to provide this program as a web service. A user can visit a > site and through a web interface he should upload the file to the web > server , the ser

Re: how to get the os file icon for a given content-type?

2006-08-28 Thread Bruno Desthuilliers
neoedmund a écrit : > So what? Java 5.0 has the method, why python has not? Sidenote : I didn't say it was not possible in Python. Just that it's OS (or desktop-manager) specific, so you have to check your OS (or desktop-manager) API documentation. -- http://mail.python.org/mailman/listinfo/pyt

Re: how to get the os file icon for a given content-type?

2006-08-28 Thread Bruno Desthuilliers
Martin v. Löwis a écrit : > Paul Boddie schrieb: > >>neoedmund wrote: >> >>[File icons for a given content type] >> >> >>>So what? Java 5.0 has the method, why python has not? >> >>I'd be generally surprised if whichever Java API responsible for this >>managed to work it out correctly for the diff

Re: how to get the os file icon for a given content-type?

2006-08-28 Thread Bruno Desthuilliers
neoedmund a écrit : please don't top-post (corrected) > Bruno Desthuilliers wrote: > >>neoedmund wrote: >>Please repeat the whole question in the message body >> >>=>how to get the os file icon for a given content-type? >> >>>any simple method? >> >>This is specific to your OS (and FWIW, there's

Max OSX and Excel

2006-08-28 Thread Johanna Pfalz
Hi there, Does anyone have details on how to drive excel using python 2.4 on OSX? I've searched the web and have not found anything specific to excel. Thanks in advance, Johanna Pfalz Smithers, BC -- http://mail.python.org/mailman/listinfo/python-list

Anonymous dynamic import

2006-08-28 Thread Christian Convey
Anyone know how to do this?:I want a way to dynamically import modules (module names not known until runtime).  I want to end up with a handle to the resulting module object, without having poluted my global module namespace in the process. Basically I want to something like this:def  call_all_user

Re: Misleading error message when opening a file (on Windows XP SP 2)

2006-08-28 Thread Georg Brandl
Claudio Grondi wrote: > Tim Peters wrote: >> [Claudio Grondi] >> >>> Here an example of what I mean >>> (Python 2.4.2, IDLE 1.1.2, Windows XP SP2, NTFS file system, 80 GByte >>> large file): >>> >>> >>> f = file('veryBigFile.dat','r') >>> >>> f = file('veryBigFile.dat','r+') >>> >>> Traceback (m

Re: class problem

2006-08-28 Thread Bruno Desthuilliers
fegge a écrit : > when i declare a class, is there difference between the below: > class myClass(): > class myClass(threading.Thread) > If you don't know the answer to this, then it's time to read the fine manual. Please come back when done. -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for data on csv files

2006-08-28 Thread Bruno Desthuilliers
flit a écrit : > Hi! > I am using the csv modules.. > > when I use the command: > > if nome in row[rowcsv]: > print "\n" > print row[rowcsv] + "\n > " + row[11] + "\n" > print > "" Python 2

Re: how do you get the name of a dictionary?

2006-08-28 Thread Georg Brandl
Antoon Pardon wrote: > On 2006-08-23, Georg Brandl <[EMAIL PROTECTED]> wrote: >> jojoba wrote: And what im saying is that isnt it silly that we need pass an entire namespace, when a much simpler notion would be to have each object know its own name(s) (even if that name doesnt exist)

Re: callable to disappear?

2006-08-28 Thread Georg Brandl
Bruno Desthuilliers wrote: > Georg Brandl a écrit : >> Antoon Pardon wrote: >> >>> I have been reading http://www.python.org/dev/peps/pep-3100/ >>> en there is written: >>> >>> To be removed: >>> ... >>> >>> callable(): just call the object and catch the exception >>> ... >>

Re: inheritance?

2006-08-28 Thread Bruno Desthuilliers
KraftDiner a écrit : (snip) > > Here I tried this example and maybe this will explain the difficulties > I'm having. > 1) at the time the baseClass is constructed shouldn't the constructor > of the appropriate type be called. It is. But neither the constructor nor 'the appropriate type' are what

Re: looking for data on csv files

2006-08-28 Thread faulkner
import re if re.search(nome, row[rowcsv], re.I): ... that's re.I [capital i] as in ignorecase. flit wrote: > Hi! > I am using the csv modules.. > > when I use the command: > > if nome in row[rowcsv]: > print "\n" > print row[rowcsv] + "\n > " + row[11] + "\n" >

Re: How to store ASCII encoded python string?

2006-08-28 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, micahc wrote: > So, how do I store "\tsome text\xa7 some more text\n" as that instead > of: > " some text§ some more text > " > > I don't have a problem escaping it so the above would look like > "\\tsome text\\xa7 some more text\\n" as long as I have a way to later >

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-28 Thread Dr.Ruud
Jim Gibson schreef: > The problem addressed by what is know in Perl as the 'Schwartzian > Transform' is that the compare operation can be an expensive one, > regardless of the whether the comparison uses multiple keys. Since in > comparison sorts, the compare operation will be executed N(logN) > t

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-28 Thread Dieter Maurer
"Patrick Maupin" <[EMAIL PROTECTED]> writes on 26 Aug 2006 12:51:44 -0700: > ... > The only > problem I personally know of is that the __slots__ aren't inherited, "__slots__" *ARE* inherited, although the rules may be a bit complex. >>> class B(object): ... __slots__ = ('f1', 'f2',) ... >>> cla

looking for data on csv files

2006-08-28 Thread flit
Hi! I am using the csv modules.. when I use the command: if nome in row[rowcsv]: print "\n" print row[rowcsv] + "\n > " + row[11] + "\n" print "" there is this case: 1- data on file PUItar

Re: How to let a loop run for a while before checking for break condition?

2006-08-28 Thread Claudio Grondi
Sorin Schwimmer wrote: > I am thinking on something in the following form: > > > import time > import thread > > delay=True > > def fn() > global delay > time.sleep() > delay=False > > thread.start_new_thread(fn,()) > > while delay: > > > ... > > while : > > > ... > > > Or,

Re: unit test for a printing method

2006-08-28 Thread Fredrik Lundh
Scott David Daniels wrote: > For silly module myprog.py: > def A(s): > print '---'+s+'---' > in test_myprog.py: > import unittest > from cStringIO import StringIO # or from StringIO ... why are you trying to reinvent doctest ? -- http://mail.python.org/mailman/listin

Twisted server and protocol question

2006-08-28 Thread Benry
Hi guys. I hope I can discuss Twisted here. If not, direct me to the correct place please. My question(s): I'm working on a custom network protocol (application layer in TCP/IP model) for a custom network. Please don't try to talk me out of this. I'm limiting many of the other protocols, becaus

  1   2   3   >