Re: Docstrings for class attributes

2008-09-23 Thread Bruno Desthuilliers
Tom Harris a écrit : Greetings, I want to have a class as a container for a bunch of symbolic names for integers, eg: class Constants: FOO = 1 BAR = 2 Do you have a reason to stuff them in a class ? Usually, putting them at the top level of a module is quite enough... Except that

Re: Why no tailcall-optimization?

2008-09-23 Thread Bruno Desthuilliers
process a écrit : Why doesn't Python optimize tailcalls? Design choice. tail-recursive calls optimization makes debugging harder. Note that this has been discussed quite a few times here. Are there plans for it? I know GvR dislikes some of the functional additions like reduce and Python is

Re: Using vObject

2008-09-23 Thread Diez B. Roggisch
Joshua Gardner schrieb: I'm brand new to USENET so please bear with me. I'm writing a specialized to-do list app. I'm using Django but this is not a question about Django. It has to have recurring tasks set by the managers for the employees to then check off. I've got pretty much everything in

Re: A bit weird dictionary behavior

2008-09-23 Thread Bruno Desthuilliers
Carl Banks a écrit : On Sep 22, 3:43 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] a écrit : Pekka Laukkanen: but it still doesn't feel exactly right. Would it be worth submitting a bug? It feels wrong because it is. In a tidier language (Pascal, Java, etc) a boolean a

Re: gplt from scipy missing ?

2008-09-23 Thread Gabriel Genellina
En Mon, 22 Sep 2008 23:19:49 -0300, Ivan Reborin <[EMAIL PROTECTED]> escribió: I'm relatively new to python. I'm following a tutorial I found on the net, and it uses scipy's gplt for plotting. I installed scipy from their website (win32 installation), numpy also, but when I do from scipy impo

Re: a short-cut command for globals().clear() ??

2008-09-23 Thread Terry Reedy
MRAB wrote: How about something like this: def clear_workspace(): keep_set = set(['__builtins__', '__doc__', '__name__', 'clear_workspace']) For 2.6/3.0, add __package__ to the list to be kept. for x in globals().keys(): if x not in keep_set: del globals()[x] --

Re: Why no tailcall-optimization?

2008-09-23 Thread Terry Reedy
process wrote: Why doesn't Python optimize tailcalls? Are there plans for it? I started to write an article on this but it disappeared So short answer: 1. Unless down very carefully, in a way that would slow things down, it would change the semantics of Python. 2. It is usually trivial to

Re: Why no tailcall-optimization?

2008-09-23 Thread Carl Banks
On Sep 22, 9:13 pm, process <[EMAIL PROTECTED]> wrote: > Why doesn't Python optimize tailcalls? Are there plans for it? The main technical difficulty is that the compiler has to know whether the function returns a tail call or not at compile time. But because Python is fully dynamic with regard t

Re: any tool can shrink DLL?

2008-09-23 Thread Miki
Hello, > So, is there such a tool that can scan a DLL then strip the unused > function's code out, so yields a small working DLL? I don't think a utility from the outside will know about unused code in a DLL? Usually the compiler is the one doing dead code elimination. The only thing that comes t

Re: Problems running on hp dual core processor

2008-09-23 Thread Miki
Hello, > I have a number of clients running a program built with > python 2.5.  One has just purchased an HP with a duel > core processor,  2.2G with .099g ram. > > On the new hp, when they try to print they get an > import error; > File win32ui.pyc line 12, in > File win32ui.pyc, line 10, in _lo

Re: Regex Help

2008-09-23 Thread Miki
Hello, > Anybody know of a good regex to parse html links from html code? BeautifulSoup is *the* library to handle HTML from BeautifulSoup import BeautifulSoup from urllib import urlopen soup = BeautifulSoup(urlopen("http://python.org/";)) for a in soup("a"): print a["href"] HTH, -- Miki <[

Re: Time.sleep(0.0125) not available within Linux

2008-09-23 Thread Gabriel Genellina
En Mon, 22 Sep 2008 23:09:50 -0300, Blubaugh, David A. <[EMAIL PROTECTED]> escribió: I was wondering if anyone has come across the issue of not being allowed to have the following within a Python script operating under Linux: time.sleep(0.0125) It appears that I am not allowed to have the ob

python freeze help

2008-09-23 Thread Gabriel Rossetti
Hello everyone, I'm trying to use python's freeze utility but I'm running into problems. I called it like this : python /usr/share/doc/python2.5/examples/Tools/freeze/freeze.py ~/Documents/Code/Python/src/jester/service.py -m jester then I did : make then I tried to run it : ./service and

adding in-place operator to Python

2008-09-23 Thread Arash Arfaee
Hi All, Is there anyway to add new in-place operator to Python? Or is there any way to redefine internal in-place operators? Thanks. Cheers, Arash -- http://mail.python.org/mailman/listinfo/python-list

Re: adding in-place operator to Python

2008-09-23 Thread Gerhard Häring
Arash Arfaee wrote: Hi All, Is there anyway to add new in-place operator to Python? You can't create new syntax, like %= Or is there any way to redefine internal in-place operators? What you can do is give your objects the ability to use these operators. See http://docs.python.org/ref/nu

Comparing float and decimal

2008-09-23 Thread D'Arcy J.M. Cain
I'm not sure I follow this logic. Can someone explain why float and integer can be compared with each other and decimal can be compared to integer but decimal can't be compared to float? >>> from decimal import Decimal >>> i = 10 >>> f = 10.0 >>> d = Decimal("10.00") >>> i == f True >>> i == d Tr

Re: python timers and COM/directshow

2008-09-23 Thread Tim Golden
Sayanan Sivaraman wrote: So I've written a simple video player using directshow/COM in VC++, and I'm in the process of translating it to python. For example, when the avi starts playing, I have a call media_control.Run() , etc. I'm wondering how I should go about updating my gtk.Hscale widget a

Re: gplt from scipy missing ?

2008-09-23 Thread Ivan Reborin
On Tue, 23 Sep 2008 04:26:14 -0300, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > >I think scipy does not bundle plotting packages anymore - you may use >whatever suits you, from other sources. >Try matplotlib, see the wiki: >http://wiki.python.org/moin/NumericAndScientific/Plotting Hello

Re: gplt from scipy missing ?

2008-09-23 Thread Ivan Reborin
On Tue, 23 Sep 2008 13:44:41 +0200, Ivan Reborin <[EMAIL PROTECTED]> wrote: >On Tue, 23 Sep 2008 04:26:14 -0300, "Gabriel Genellina" ><[EMAIL PROTECTED]> wrote: > >> >>I think scipy does not bundle plotting packages anymore - you may use >>whatever suits you, from other sources. >>Try matplotlib

Re: Docstrings for class attributes

2008-09-23 Thread Diez B. Roggisch
Tom Harris wrote: > Greetings, > > I want to have a class as a container for a bunch of symbolic names > for integers, eg: > > class Constants: > FOO = 1 > BAR = 2 > > Except that I would like to attach a docstring text to the constants, > so that help(Constants.FOO) will print some arb

finding domain name

2008-09-23 Thread Bobby Roberts
hi group. I'm new to python and need some help and hope you can answer this question. I have a situation in my code where i need to create a file on the server and write to it. That's not a problem if i hard code the path. However, the domain name needs to be dynamic so it is picked up automati

Re: gplt from scipy missing ?

2008-09-23 Thread Michael Palmer
On Sep 23, 7:44 am, Ivan Reborin <[EMAIL PROTECTED]> wrote: > On Tue, 23 Sep 2008 04:26:14 -0300, "Gabriel Genellina" > > <[EMAIL PROTECTED]> wrote: > > >I think scipy does not bundle plotting packages anymore - you may use > >whatever suits you, from other sources. > >Try matplotlib, see the wiki:

Re: Comparing float and decimal

2008-09-23 Thread Gerhard Häring
D'Arcy J.M. Cain wrote: I'm not sure I follow this logic. Can someone explain why float and integer can be compared with each other and decimal can be compared to integer but decimal can't be compared to float? from decimal import Decimal i = 10 f = 10.0 d = Decimal("10.00") i == f True i ==

Re: finding domain name

2008-09-23 Thread Gerhard Häring
Bobby Roberts wrote: hi group. I'm new to python and need some help and hope you can answer this question. I have a situation in my code where i need to create a file on the server and write to it. That's not a problem if i hard code the path. However, the domain name needs to be dynamic so i

Re: finding domain name

2008-09-23 Thread Joe Riopel
On Tue, Sep 23, 2008 at 8:37 AM, Bobby Roberts <[EMAIL PROTECTED]> wrote: > hi group. I'm new to python and need some help and hope you can > answer this question. I have a situation in my code where i need to > create a file on the server and write to it. That's not a problem if > i hard code t

Re: finding domain name

2008-09-23 Thread Bobby Roberts
> Depends on the technology/web framework. If you use WSGI, you should use > something like: > > host_name = environ.get("HTTP_HOST", None) or environ["SERVER_NAME"] > > -- Gerhard Yeah i already tried environ("SERVER_NAME") but get a key error when i do. -- http://mail.python.org/mailman/listin

Pyflix, confused about super() call

2008-09-23 Thread process
Anyone using Pyflix for the Netflix prize. How can it call super to itself in its init-method? - #!/usr/bin/env python '''Sample baseline averaging algorithms.''' import numpy as N from pyflix.algorithms import Algorithm class MovieAverage(Algorithm): '''Baseline

Re: Comparing float and decimal

2008-09-23 Thread Robert Lehmann
On Tue, 23 Sep 2008 07:20:12 -0400, D'Arcy J.M. Cain wrote: > I'm not sure I follow this logic. Can someone explain why float and > integer can be compared with each other and decimal can be compared to > integer but decimal can't be compared to float? In comparisons, `Decimal` tries to convert

Re: finding domain name

2008-09-23 Thread Bobby Roberts
On Sep 23, 8:54 am, "Joe Riopel" <[EMAIL PROTECTED]> wrote: > On Tue, Sep 23, 2008 at 8:37 AM, Bobby Roberts <[EMAIL PROTECTED]> wrote: > > hi group.  I'm new to python and need some help and hope you can > > answer this question.  I have a situation in my code where i need to > > create a file on

Python-URL! - weekly Python news and links (Sep 23)

2008-09-23 Thread Gabriel Genellina
QOTW: "Python is THE real integration/composition platform !" - Nicolas Lehuen http://groups.google.com/group/comp.lang.python/msg/05dd6fa4509ab15c Python 2.6rc2 and 3.0rc1 have been released: http://groups.google.com/group/comp.lang.python/browse_thread/thread/6a285ea5e

Re: New Web2Py framework SLASHES development time...

2008-09-23 Thread mdipierro
Hi Paul, yes, the model designer is the one from Ondras. We modified it so that it generates DAL (Database Abstraction Layer) code instead of SQL and it is a work in progress. Technically it is not pat of web2py and in fact it is not distributed with it. It is just one of the many web2py apps. You

Re: finding domain name

2008-09-23 Thread Tino Wildenhain
Bobby Roberts wrote: Depends on the technology/web framework. If you use WSGI, you should use something like: host_name = environ.get("HTTP_HOST", None) or environ["SERVER_NAME"] -- Gerhard Yeah i already tried environ("SERVER_NAME") but get a key error when i do. You could output the whole

Mutex not thread safe? PEP-3108.

2008-09-23 Thread Roy Smith
I'm perusing PEP-3108 and came upon this interesting statement (under the "Hardly used" section): mutex [...] Not thread-safe. How can a mutex, whose sole reason for existence is to mediate thread safety, not be thread safe? -- http://mail.python.org/mailman/listinfo/python-list

Python is slow?

2008-09-23 Thread sturlamolden
I have recently been playing with a kd-tree for solving the "post office problem" in a 12-dimensional space. This is pure cpu bound number crunching, a task for which I suspected Python to be inefficient. My prototype in Python 2.5 using NumPy required 0.41 seconds to construct the tree from 50,00

Re: Mutex not thread safe? PEP-3108.

2008-09-23 Thread skip
> "Roy" == Roy Smith <[EMAIL PROTECTED]> writes: Roy> I'm perusing PEP-3108 and came upon this interesting statement Roy> (under the "Hardly used" section): Roy> mutex [...] Not thread-safe. Roy> How can a mutex, whose sole reason for existence is to mediate thread Roy>

Re: Mutex not thread safe? PEP-3108.

2008-09-23 Thread Hrvoje Niksic
Roy Smith <[EMAIL PROTECTED]> writes: > I'm perusing PEP-3108 and came upon this interesting statement (under the > "Hardly used" section): > > mutex [...] Not thread-safe. > > How can a mutex, whose sole reason for existence is to mediate thread > safety, not be thread safe? "mutex" is a modul

Re: Why no tailcall-optimization?

2008-09-23 Thread sturlamolden
On Sep 23, 3:13 am, process <[EMAIL PROTECTED]> wrote: > Why doesn't Python optimize tailcalls? Are there plans for it? Because Python is a dynamic language. While a function is executing, its name may be bound to another object. It may happen as a side effect of what the function is doing, or ev

The World Trade Plaza - Free Trade Leads

2008-09-23 Thread merwick.k
FREE INTERNATIONAL TRADE LEADS ==> The World Trade Plazahttp://trade-plaza.blogspot.com Are you looking for potential clients for your products? Are you looking for a free place for to display your products? Each day we publish international purchase requisitions and offers for sale. The Tra

Re: Python is slow?

2008-09-23 Thread Robert Singer
On Tue, 23 Sep 2008 06:23:12 -0700 (PDT), sturlamolden <[EMAIL PROTECTED]> wrote: >I have recently been playing with a kd-tree for solving the "post >office problem" in a 12-dimensional space. This is pure cpu bound >number crunching, a task for which I suspected Python to be >inefficient. Well,

Re: Why no tailcall-optimization?

2008-09-23 Thread Jean-Paul Calderone
On Tue, 23 Sep 2008 06:41:33 -0700 (PDT), sturlamolden <[EMAIL PROTECTED]> wrote: On Sep 23, 3:13 am, process <[EMAIL PROTECTED]> wrote: Why doesn't Python optimize tailcalls? Are there plans for it? Because Python is a dynamic language. While a function is executing, its name may be bound t

Call for Papers, Volume 3 Issue 3

2008-09-23 Thread [EMAIL PROTECTED]
We would like to call for papers, articles, opinion pieces and feedback to include in Volume 3, Issue 3 of The Python Papers. We would love to receive articles on Python for beginners and discussions about Python performance. Any article will be gratefully received, of course, so do not let the abo

Re: Python is slow?

2008-09-23 Thread Grant Edwards
On 2008-09-23, sturlamolden <[EMAIL PROTECTED]> wrote: [...] > After having a working Python prototype, I resorted to rewrite the > program in C++. The Python prototype took an hour to make, debug and > verify. The same thing in C++ took me almost a day to complete, even > with a working prototyp

Re: improving a huge double-for cycle

2008-09-23 Thread km
how abt this ? N = len(IN) for k in range(N): for j in range(N): if j >= k: # or k <= j doSomething() KM ~~~ On Thu, Sep 18, 2008 at 6:27 PM, Tim Chase <[EMAIL PROTECTED]>wrote: > Code: Select all >>for i in range(len(IN)): #scan all eleme

Re: Comparing float and decimal

2008-09-23 Thread Michael Palmer
> > This seems to break the rule that if A is equal to B and B is equal to C > > then A is equal to C. > > I don't see why transitivity should apply to Python objects in general. Well, for numbers it surely would be a nice touch, wouldn't it. May be the reason for Decimal to accept float argument

Re: Python is slow?

2008-09-23 Thread George Sakkis
On Sep 23, 9:57 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-09-23, sturlamolden <[EMAIL PROTECTED]> wrote: > > [...] > > > After having a working Python prototype, I resorted to rewrite the > > program in C++. The Python prototype took an hour to make, debug and > > verify. The same thi

Re: Python is slow?

2008-09-23 Thread skip
>> We may conclude that I'm bad at programming C++, Grant> AFAICT, _everybody_ is bad at programming C++. Grant> One begins to suspect it's not the fault of the programmers. +1 QOTW... Skip -- http://mail.python.org/mailman/listinfo/python-list

tkFileDialog and locale under Linux

2008-09-23 Thread Matthias Huening
Hi, I have problems using tkFileDialog under Linux (Ubuntu 8.04 in my case, but other Linuxes seem to show the same behaviour). The following works fine: import tkFileDialog f = tkFileDialog.askopenfilename() No problem, I can chose a filename. But when switching the locale (in my case to G

Re: improving a huge double-for cycle

2008-09-23 Thread Tim Chase
km wrote: how abt this ? N = len(IN) for k in range(N): for j in range(N): if j >= k: # or k <= j doSomething() This has the root problem that the "if" statement is evaluated N*N times, which is ugly/slow O(N^2) behavior. My solution managed to reduc

Attachment Size and SMTP EMail

2008-09-23 Thread Eric E
Hello All - I am using python to send an email with a large zip file as an attachment. I successfully sent a 52M attachment. If I try to send a 63M attachment or larger, the message never gets through. I do not get any errors in my python code. I pasted my python code below. from email.MIMEBa

Re: Attachment Size and SMTP EMail

2008-09-23 Thread Grant Edwards
On 2008-09-23, Eric E <[EMAIL PROTECTED]> wrote: > I am using python to send an email with a large zip file as an > attachment. I successfully sent a 52M attachment. If I try > to send a 63M attachment or larger, the message never gets > through. I do not get any errors in my python code. Does

Re: finding domain name

2008-09-23 Thread Bobby Roberts
On Sep 23, 9:10 am, Tino Wildenhain <[EMAIL PROTECTED]> wrote: > Bobby Roberts wrote: > >> Depends on the technology/web framework. If you use WSGI, you should use > >> something like: > > >> host_name = environ.get("HTTP_HOST", None) or environ["SERVER_NAME"] > > >> -- Gerhard > > > Yeah i already

Linq to Python

2008-09-23 Thread hrishy
Hi Will LINQ be ported to Python ? regards Hrishy -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyflix, confused about super() call

2008-09-23 Thread Bruno Desthuilliers
process a écrit : Anyone using Pyflix for the Netflix prize. How can it call super to itself in its init-method? You mean : class MovieAverage(Algorithm): def __init__(self, training_set): self._movie_averages = {} this line ? super(MovieAverage,self).__init__(tr

Re: Linq to Python

2008-09-23 Thread Diez B. Roggisch
hrishy wrote: > Hi > > Will LINQ be ported to Python ? Take a look at SQLAlchemy or SQLObject for python-based ORM/SQL-abstractions. Apart from that, python is already heavily based on concepts like iterators, filtering. Take a look at itertools. Diez -- http://mail.python.org/mailman/listinfo

Re: Docstrings for class attributes

2008-09-23 Thread Peter Pearson
On Tue, 23 Sep 2008 15:23:35 +1000, Tom Harris <[EMAIL PROTECTED]> wrote: > > I want to have a class as a container for a bunch of symbolic names > for integers, eg: > > class Constants: > FOO = 1 > BAR = 2 > > Except that I would like to attach a docstring text to the constants, > so that

Re: Attachment Size and SMTP EMail

2008-09-23 Thread Eric E
On Sep 23, 9:52 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-09-23, Eric E <[EMAIL PROTECTED]> wrote: > > > I am using python to send an email with a large zip file as an > > attachment. I successfully sent a 52M attachment. If I try > > to send a 63M attachment or larger, the message n

Re: python freeze help

2008-09-23 Thread Mike Driscoll
On Sep 23, 5:01 am, Gabriel Rossetti <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I'm trying to use python's freeze utility but I'm running into problems. > I called it like this : > > python /usr/share/doc/python2.5/examples/Tools/freeze/freeze.py > ~/Documents/Code/Python/src/jester/service.p

Re: finding domain name

2008-09-23 Thread Bruno Desthuilliers
Bobby Roberts a écrit : On Sep 23, 9:10 am, Tino Wildenhain <[EMAIL PROTECTED]> wrote: Bobby Roberts wrote: Depends on the technology/web framework. If you use WSGI, you should use something like: host_name = environ.get("HTTP_HOST", None) or environ["SERVER_NAME"] -- Gerhard Yeah i already tr

Re: Linq to Python

2008-09-23 Thread hrishy
Hi Thanks for those links however LINQ seems to be much more then ORM tool it can for example join an XML file with a relational datasource or create a XSD regards Hrishy --- On Tue, 23/9/08, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > From: Diez B. Roggisch <[EMAIL PROTECTED]> > Subject:

Re: Python is slow?

2008-09-23 Thread bearophileHUGS
sturlamolden: CPython is generally slow (you can see this from the huge amount of solutions invented to solve the speed problem, like Cython, Numpy, Psyco, ShedSkin, Weave, Inline, SIP, Boost Python, SWIG, etc etc), but for most of the usages Python is used for, it's not a significant problem. I k

lxml and adding a stylesheet

2008-09-23 Thread Sean Davis
I have an xml document and simply need to add an xml-stylesheet to it. I am using lxml to parse the xml document and then would like to insert the xml-stylesheet tag using the etree api. Any suggestions? Thanks, Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing float and decimal

2008-09-23 Thread Michael Palmer
On Sep 23, 10:08 am, Michael Palmer <[EMAIL PROTECTED]> wrote: > May be the reason for Decimal to accept float arguments is that NOT to accept float arguments. -- http://mail.python.org/mailman/listinfo/python-list

Re: download redtube video - Free

2008-09-23 Thread henrypopie
Hello, You can download Redtube videos to your Computer, iPod, PSP or other mobile devices.. Just get a RedTube Downloader from here: http://www.downloadvideos-convert.com/redtube-downloader --- Enjoy it~ Download Videos from RedTube, YouPorn, PornoTube, XTube, Tube8, X

Re: download redtube video - Free

2008-09-23 Thread henrypopie
Or download RedTube videos online: http://www.download-redtube.com/ -- http://mail.python.org/mailman/listinfo/python-list

SPE restore defaults

2008-09-23 Thread Samuel Morhaim
Hi, I am sorry if this is a bit off topic... I downloaded SPE, but i changed the config option by mistake to a Skin only for Mac... so everytime i start SPE it crashes. I tried uninstalling, but it didnt work, it seems the value is in the registry, but i couldnt find it. Can anyone help? (Spe fo

Re: how can I use a callable object as a method

2008-09-23 Thread Piotr Sobolewski
Hrvoje Niksic wrote: >> However, the second version does not work. I think I understand >> why. That's because "a" inside f1 is not a function (but an object). > > An object that defines __call__ is perfectly usable as a function. > Your problem is that it doesn't know how to convert itself to a

Re: finding domain name

2008-09-23 Thread Tino Wildenhain
Hi, Bobby Roberts wrote: On Sep 23, 9:10 am, Tino Wildenhain <[EMAIL PROTECTED]> wrote: Bobby Roberts wrote: Depends on the technology/web framework. If you use WSGI, you should use something like: host_name = environ.get("HTTP_HOST", None) or environ["SERVER_NAME"] -- Gerhard Yeah i already

Re: Not fully OO ?

2008-09-23 Thread Tim Rowe
2008/9/23 Craig Allen <[EMAIL PROTECTED]>: > So python may turn out to be pure OO I think that's the sort of thing the pedants would hang that hats on, too. Python isn't *pure* OO, in that it lets the programmers do non-OO if they want to, but it is *fully* OO in that it includes everything requi

Re: Linq to Python

2008-09-23 Thread Jason Scheirer
On Sep 23, 7:48 am, hrishy <[EMAIL PROTECTED]> wrote: > Hi > > Will LINQ be ported to Python ? > > regards > Hrishy I think this question is more appropriate to ask on an IronPython development list -- LINQ is pretty solidly intertwined with .Net, and so you'll likely want to look at the .Net impl

Matrix programming

2008-09-23 Thread A. Joseph
I need an ebook or tutorial that teach matrix programming. -- http://mail.python.org/mailman/listinfo/python-list

Re: Docstrings for class attributes

2008-09-23 Thread George Sakkis
On Sep 23, 1:23 am, "Tom Harris" <[EMAIL PROTECTED]> wrote: > Greetings, > > I want to have a class as a container for a bunch of symbolic names > for integers, eg: > > class Constants: > FOO = 1 > BAR = 2 > > Except that I would like to attach a docstring text to the constants, > so that

Re: Matrix programming

2008-09-23 Thread Gary Herron
A. Joseph wrote: I need an ebook or tutorial that teach matrix programming. Perhaps you should start here: http://www.catb.org/~esr/faqs/smart-questions.html#intro Gary Herron -- http://mail.python.org/mailman/listi

Detecting the first time I open/append to a file

2008-09-23 Thread tkpmep
I have a simulation that runs many times with different parameters, and I want to aggregate the output into a single file with one rub: I want a header to be written only the first time. My program looks a bit like this: def main(): for param in range(10): simulate(param) def simulat

Re: Linq to Python

2008-09-23 Thread namekuseijin
On Sep 23, 2:07 pm, Jason Scheirer <[EMAIL PROTECTED]> wrote: > On Sep 23, 7:48 am, hrishy <[EMAIL PROTECTED]> wrote: > > > Hi > > > Will LINQ be ported to Python ? > > > regards > > Hrishy > > I think this question is more appropriate to ask on an IronPython > development list -- LINQ is pretty so

Re: adding in-place operator to Python

2008-09-23 Thread Terry Reedy
Arash Arfaee wrote: Hi All, Is there anyway to add new in-place operator to Python? Or is there any way to redefine internal in-place operators? Python does not have 'in-place operators'. It has 'augmented assignment statements' that combines a binary operation with an assignment. *If* th

Re: Python is slow?

2008-09-23 Thread sturlamolden
On Sep 23, 3:44 pm, Robert Singer <[EMAIL PROTECTED]> wrote: > Well, python is not a number crunching language. However much we would > like it to be (we would ? :-). > No scripting language is. Not even Matlab, R, IDL, Octave, SciLab, S-PLUS or Mathematica? > Before resorting to rewriting the

Re: Python is slow?

2008-09-23 Thread sturlamolden
On Sep 23, 5:31 pm, [EMAIL PROTECTED] wrote: > Well written C++ code is generally faster or much faster than similar > Python code, but programming in Python is often simpler, and it > generally requires less time. So it may happen that to solve a problem > a Python program that runs in 1 hour tha

Re: Detecting the first time I open/append to a file

2008-09-23 Thread Sean Davis
On Sep 23, 2:02 pm, [EMAIL PROTECTED] wrote: > I have a simulation that runs many times with different parameters, > and I want to aggregate the output into a  single file with one rub: I > want a header to be written only the first time. My program looks a > bit like this: > > def main(): >     fo

Re: Detecting the first time I open/append to a file

2008-09-23 Thread Arnaud Delobelle
On Sep 23, 7:02 pm, [EMAIL PROTECTED] wrote: > I have a simulation that runs many times with different parameters, > and I want to aggregate the output into a  single file with one rub: I > want a header to be written only the first time. My program looks a > bit like this: > > def main(): >     fo

Re: Comparing float and decimal

2008-09-23 Thread Terry Reedy
Gerhard Häring wrote: D'Arcy J.M. Cain wrote: I'm not sure I follow this logic. Can someone explain why float and integer can be compared with each other and decimal can be compared to integer but decimal can't be compared to float? from decimal import Decimal i = 10 f = 10.0 d = Decimal("10.

Re: python timers and COM/directshow

2008-09-23 Thread Sayanan Sivaraman
On Sep 23, 4:24 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Sayanan Sivaraman wrote: > > So I've written a simple video player using directshow/COM in VC++, > > and I'm in the process of translating it to python.  For example, when > > the avi starts playing, I have a call media_control.Run() , etc

Re: Docstrings for class attributes

2008-09-23 Thread Terry Reedy
Peter Pearson wrote: On Tue, 23 Sep 2008 15:23:35 +1000, Tom Harris <[EMAIL PROTECTED]> wrote: I want to have a class as a container for a bunch of symbolic names for integers, eg: class Constants: FOO = 1 BAR = 2 Except that I would like to attach a docstring text to the constants, so

Re: python timers and COM/directshow

2008-09-23 Thread Sayanan Sivaraman
You're right. Let me be more specific. Firstly, the reason I included c++ code is because I'm using Microsoft COM, which is natively in c++, and in fact, to access them through Python I use the comtypes module [import comtypes] and then GetModule('quartz.dll') to access the dll's. I am using the

FREE INTERNATIONAL TRADE LEADS

2008-09-23 Thread [EMAIL PROTECTED]
http://groups.google.com/group/comp.lang.python/browse_thread/thread/33f3659cc4d30b22# http://groups.google.com/group/comp.lang.python/browse_thread/thread/33f3659cc4d30b22# http://groups.google.com/group/comp.lang.python/browse_thread/thread/33f3659cc4d30b22# http://groups.google.com/group/comp.la

Re: Linq to Python

2008-09-23 Thread Thomas G. Willis
> But surely the idea behind it will eventually spread.  It's really > just comprehensions generalized over XML and relational datasets, a > noble goal.  Besides, it's main purpose for .NET was to bring > functional programming to it.  Python already has that, somewhat... it's really any object o

Re: Python is slow?

2008-09-23 Thread namekuseijin
On Sep 23, 10:57 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > AFAICT, _everybody_ is bad at programming C++. Thankfully, at least Numpy developers are not bad at C programming. -- http://mail.python.org/mailman/listinfo/python-list

Re: Linq to Python

2008-09-23 Thread sturlamolden
On Sep 23, 4:48 pm, hrishy <[EMAIL PROTECTED]> wrote: > Will LINQ be ported to Python ? No, because Python already has list comprehensions and we don't need the XML buzzword. -- http://mail.python.org/mailman/listinfo/python-list

Re: Linq to Python

2008-09-23 Thread Terry Reedy
> Will LINQ be ported to Python ? I have three suggestions: 1. When starting a new thread, start a *new* thread. Don't tack a new, unrelated subject onto an existing thread. Your post will not be seen by people with readers that collapse thread and who do not happen to read the 'Python is s

Re: Python is slow?

2008-09-23 Thread bearophileHUGS
sturlamolden: >F# and OCaml look promising though.< I bet on the future of D and Haskell (and maybe Fortress) instead :-) We'll see. >Sure I could show you the code, Python and C++, if I had a place to post it.< I think the Python version suffices. If it's not too much private you may post the

Re: Python is slow?

2008-09-23 Thread sturlamolden
On Sep 23, 8:52 pm, [EMAIL PROTECTED] wrote: > I think the Python version suffices. If it's not too much private you > may post the single minimal/reduced runnable Python module here, it > will be deleted in some time (if you want you can also use a private > paste):http://codepad.org/ http://cod

Re: Twisted: Get Protected HTTPS Page via Proxy with Authentication

2008-09-23 Thread Robert Hancock
This works: # Proxy credentials proxyAuth = base64.encodestring('%s:%s' % (proxy_username, proxy_password)) proxy_authHeader = "Basic " + proxyAuth.strip() # Web site credentials basicAuth = base64.encodestring('%s:%s' % (username, password)) authHea

Re: Python is slow?

2008-09-23 Thread Robert Kern
[EMAIL PROTECTED] wrote: sturlamolden: Sure I could show you the code, Python and C++, if I had a place to post it.< I think the Python version suffices. If it's not too much private you may post the single minimal/reduced runnable Python module here, it will be deleted in some time (if you

Re: Detecting the first time I open/append to a file

2008-09-23 Thread Bruno Desthuilliers
Sean Davis a écrit : On Sep 23, 2:02 pm, [EMAIL PROTECTED] wrote: I have a simulation that runs many times with different parameters, and I want to aggregate the output into a single file with one rub: I want a header to be written only the first time. My program looks a bit like this: def mai

Re: finding domain name

2008-09-23 Thread Bruno Desthuilliers
Bobby Roberts a écrit : hi group. I'm new to python and need some help and hope you can answer this question. I have a situation in my code where i need to create a file on the server and write to it. That's not a problem if i hard code the path. However, the domain name needs to be dynamic s

Re: Python is slow?

2008-09-23 Thread J Peyret
On Sep 23, 8:31 am, [EMAIL PROTECTED] wrote: Guys, this looks like a great data structure/algo for something I am working on. But... where do I find some definitions of the original BK-tree idea? I looked through Amazon and only a few books mention something like BK-Tree and these are mostly conf

Re: Python is slow?

2008-09-23 Thread sturlamolden
On Sep 23, 9:17 pm, Robert Kern <[EMAIL PROTECTED]> wrote: > You could also drop it on the scipy.org wiki in the Cookbook category. Yes, if I could figure out how to use it... -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is slow?

2008-09-23 Thread Robert Kern
J Peyret wrote: On Sep 23, 8:31 am, [EMAIL PROTECTED] wrote: Guys, this looks like a great data structure/algo for something I am working on. But... where do I find some definitions of the original BK-tree idea? Uh, actually we're talking about kd-trees, not BK-trees. kd-trees are for search

Re: Docstrings for class attributes

2008-09-23 Thread Gerard flanagan
George Sakkis wrote: On Sep 23, 1:23 am, "Tom Harris" <[EMAIL PROTECTED]> wrote: Greetings, I want to have a class as a container for a bunch of symbolic names for integers, eg: class Constants: FOO = 1 BAR = 2 Except that I would like to attach a docstring text to the constants, so

Does anybody use this web framework ?

2008-09-23 Thread Phil Cataldo
Hi, I just found this new? python web framework (http://pypi.python.org/pypi/nagare/0.1.0). Does anybody know or use it ? Regards, Phil -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is slow?

2008-09-23 Thread Robert Singer
On Tue, 23 Sep 2008 11:07:22 -0700 (PDT), sturlamolden <[EMAIL PROTECTED]> wrote: >On Sep 23, 3:44 pm, Robert Singer <[EMAIL PROTECTED]> wrote: > >> Well, python is not a number crunching language. However much we would >> like it to be (we would ? :-). > >> No scripting language is. > >Not even M

  1   2   >