On Mon, Jul 21, 2008 at 10:31 PM, youtoo <[EMAIL PROTECTED]> wrote:
> It has been extensively discussed the time complexity (quadratic) of
> string concatenation (due to string's immutability).
Actually, it is roughly linear, at least for reasonable string lengths:
$ python -V
Python 2.5.2
$ pyth
On Mon, Jul 21, 2008 at 10:01 PM, ssecorp <[EMAIL PROTECTED]> wrote:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691
>
> so I try it and when I run:
> @Decorators.tail_recursion
> def fibtr(n):
>def fibt(a, b, n):
>if n <= 1:
>return b
>else:
>
On Wed, Jul 9, 2008 at 10:58 PM, Daniel Fetchinson
<[EMAIL PROTECTED]> wrote:
>
> > I have a list of objects that generate code. Some
> > of them depend on others being listed first, to
> > satisfy dependencies of others.
> >
> > I wrote a cmp function something like this:
> >
> > def dep_cmp(ob1,
On Jan 11, 2008 9:14 PM, Henry Baxter <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have been happily using ctypes for a while to do win32 programming. I use
> the Microsoft documentation to understand the function, then call it with the
> help of ctypes.
>
> The problem is that the docs says user32.
On 8/15/07, per9000 <[EMAIL PROTECTED]> wrote:
> Hi python people,
>
> I am trying to figure out the best way to encrypt files in python.
>
> I've build a small script (see below) that encrypts the ubuntu 7.04
> iso file in 2 minutes (I like python :) ).
>
> But I have some thoughts about it. By pu
On 8/11/07, Gregory D. Weber <[EMAIL PROTECTED]> wrote:
> I too thought += was an assignment. And it bit me very painfully a few weeks
> ago.
>
> If it's an assignment, then wouldn't "x += y" mean the same thing as "x = x +
> y"?
>
> If so, why does an assignment to variable a, below, have the *
On 8/7/07, Ricardo Aráoz <[EMAIL PROTECTED]> wrote:
> Lee Fleming wrote:
> > Thanks for all the help, everyone. I guess I was confused with default
> > arguments that were mutable and immutable. I will continue to look
> > over these posts until I understand what is happening.
> >
> > I cannot beli
On 7/13/07, J. J. Ramsey <[EMAIL PROTECTED]> wrote:
> In Perl, there is a module called "Tie::File". What it does is tie a
> list to each line of a file. Change the list, and the file is
> automatically changed, and on top of this, only the bits of the file
> that need to be changed are written to
On 6/22/07, shridhar kurhade <[EMAIL PROTECTED]> wrote:
> Hi,
> Thanks for your reply. I tried changing the ownership and it looks as below:
> # ls -l /home/ast/ast-linux.conf
> -rw-r--r-- 1 ast ast 7936 Jun 21 11:11 /home/ast/ast-linux.conf
>
> But when I try to read through browser, it gives per
On 6/21/07, Anthony Raj <[EMAIL PROTECTED]> wrote:
> Hi Folks,
>
> Having a very strange problem in using python with apache/mod_python.
>
> [conf.py attached]
>
> >>> from ast.conf import conf
> >>> c = conf()
> >>> a = c.readPath('sandbox')
> >>> len (a)
>
> >>> 30
>
> The same code when run
On 6/20/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> En Wed, 20 Jun 2007 13:58:34 -0300, linuxprog <[EMAIL PROTECTED]>
> escribió:
>
> > i have that string "helloworldok" and i want to
> > extract all the text , without html tags , the result should be some
> > thing like that : helloworldok
On 6/20/07, jvdb <[EMAIL PROTECTED]> wrote:
> The thing is, i don't want to see anything of my program, just the
> launched program.
> I already have the program working. But when i create an executable of
> it with py2exe and start it, i don't want to see that it is running,
> perhaps just in the
On 6/18/07, Robin Becker <[EMAIL PROTECTED]> wrote:
> Evan Klitzke wrote:
> > Another method that you can use is to open up a socket on some
> > predetermined port (presumably above 1024), and then have your program
> > try to connect to that port and "talk" to the other program to
> > determine wh
On 6/17/07, mark carter <[EMAIL PROTECTED]> wrote:
> I hesitate to ask, but ...
>
> I'm using Ubuntu Feisty:
> * Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
> * SQLite version 3.3.13
>
> Suppose I run the following program:
> import sqlit
On 6/17/07, Marcpp <[EMAIL PROTECTED]> wrote:
> On 17 jun, 03:53, Dan Hipschman <[EMAIL PROTECTED]> wrote:
> Hi, I need to return a tupla like this function:
>
> def BDllids(a):
> a = ()
> conn = sqlite.connect('tasques.db')
> cursor = conn.cursor()
> cursor.exe
On 6/15/07, Wiley Thomas <[EMAIL PROTECTED]> wrote:
> I'm trying to write a script to open a file on our (windows) network. The
> file is located on a machine that is not part of the domain and requires a
> separate user id and password to access. I tried using urllib2 and the
> password_manager
On Jun 2, 3:00 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> Then you have modified the code posted by Steven Bethard.
>
> > I don't see how your behaviour should come about ... a new observer-list
> > is created for every decorated method, so there is no problem.
>
> Yes, but that list is shared a
On Jun 2, 12:27 am, Steven Bethard <[EMAIL PROTECTED]> wrote:
> I think you want to define __get__ on your Observable class so that it
> can do the right thing when the method is bound to the instance:
>
> >>> class Observable(object):
> ... def __init__(self, func, instance=None, observers=No
On Jun 2, 9:32 am, mosscliffe <[EMAIL PROTECTED]> wrote:
> David,
>
> Thanks for your help.
>
> I spent all last night trying to get it to work, but I can not work
> out how to force my cookie into the response header. The most
> annoying part is on one occasion it did and the cookie sat there unt
On Jun 1, 3:49 pm, mosscliffe <[EMAIL PROTECTED]> wrote:
> I have the following code, which I thought would create a cookie, if
> one did not exist and on the html form being sent to the server, it
> would be availabe for interrogation, when the script is run a second
> time.
>
> It seems to me the
On Feb 18, 5:59 am, "Deron Meranda" <[EMAIL PROTECTED]> wrote:
> Consider a much-simplified example of such an iteration where
> sometimes you need to transform an item by some function, but most of
> the time you don't:
>
> if some_rare_condition:
> func = some_transform_function
>
Paraic Gallagher wrote:
> Hi,
>
> This is my first post to the list, I hope somebody can help me with this
> problem. Apologies if it has been posted before but I have been internet
> searching to no avail.
>
> What I am trying to do is provide a simple method for a user to change a
> config file,
vbgunz wrote:
> I am afraid that this is the first time in which I would probably need
> something explained to me as if I were a little child. I am having a
> hard time getting this through my thick skull. What in the world is
> wrong with this!?
>
> ''' ###
John Salerno wrote:
> Here is an exercise from Learning Python that I wrote myself:
>
> import sys
> import traceback
>
> class MyError: pass
>
> def oops():
> raise MyError()
>
> def safe(func, *args):
> try:
> apply(func, args)
> except:
> traceback.print_exc()
>
[EMAIL PROTECTED] wrote:
> I was under the impression, that the .pyc files will be used (if found)
> by python to speed up execution of scripts... and so we packaged,
> deployed and installed the .py/.pyc files on to the ppc-target system.
> That package includes, site.py(c), types.py(c) etc., amon
Gregory Piñero wrote:
> Ok, I tried the changes you guys suggested but same error still:
> 1. Corrected spelling of referrer.
> 2. Don't specify host.
>
> Here is what they say my request should look like:
> -
> POST /GatewayDC
Xavier Morel wrote:
> Steve Holden wrote:
> > Luiz Geron wrote:
> >> I don't have experience on this, but I think that you can make the
> >> script return the image "contents" directly to the img tag, without
> >> passing it to a img file, so you can use something like this:
> >>
> >>
> >>
> >> wi
Russell Warren wrote:
> Not true as above. The longhand for 'self.I += 1' is 'self.I = self.I
> + 1', which normally needs self.I to exist due to the RHS of this.
Try this:
>>> class foo(object):
... I = 1
... def __init__(self):
... print self.__dict__
... self.I = self.I + 1
...
[EMAIL PROTECTED] wrote:
> Hi, I've been using ActivePython 2.3 (cgi) on IIS on win xp, 2000 and
> they work fine.
> Until I upgrade the system the server 2003. The ASP script engine is ok
> but not the CGIs.
>
> I got these errors:
>
> HTTP Error 403.1 - Forbidden: Execute access is denied.
>
> I
Nainto wrote:
> I came across this link today. http://tinyurl.com/9c7ta It seems
> Microsoft is getting involved with Python. What do you think of it? Is
> it any good? Anything to worry about?
> --
> Zach
See http://www.ironpython.com/ -- apparently this happened over a year
ago.
-- David
--
h
Jay wrote:
> ok have this program and i set a socket 2 connect to the server...so i
> can chat on the channels and stuff. my question is how would i go about
> set a socket directly 2 an individual query?
The last part of this paragraph is completely incomprehensible.
> my program is right here.
Mark Carter wrote:
> I have some python scripts that run as cron jobs. They connect to
> external resources (like a newsserver) - for which passwords are
> required. I currently have them stored in the scripts themselves (ouch!)
> - and was wondering if there was a more secure solution.
Any form o
Steven D'Aprano wrote:
> I have a problem and I don't know where to start looking for a solution.
>
> I have a class that needs to call an arbitrary function and wait for a
> result. The function, being completely arbitrary and not under my control,
> may be very time consuming and possibly may not
[EMAIL PROTECTED] wrote:
> I've just started to test/learn python.
> I've got Linux > mandrake9 > python & documentation.
> What I'll initially want to be doing needs file I/O, so I
> wanted to confirm file I/O early in my tests.
>
> Following the examples :
> >>> f=open('/tmp/workfile', 'w')
> >>
Istvan Albert wrote:
> I remeber once I had truly puzzling problem that manifested itself the
> same way ... Firefox and cygwin python would work fine but the windows
> python would raise errors when trying to connect via http ...
>
> ... finally I realized that the day before IE was set to use a p
Mike Meyer wrote:
> The previous version was in a jail, which is why I didn't want it
> generally announced. The logs made amusing reading. I like Gerhard's
> idea of removing __import__, and have done that.
Oh, you have, eh? Are you absolutely sure? Try running "grep 'all your
base' log".
-- Dav
Amit Khemka wrote:
> Hello,
> I am trying to write an IM Bot, which automatically replies to a
> message, in Python.
> I was wondering If there are python modules for connecting to Yahoo!,
> msn networks ...
> ideally I would like to have a multithreaded module.
I have found that the best solution
Pierre Quentel wrote:
> Hi all,
>
> In some program I was testing if a variable was a boolean, with this
> test : if v in [True,False]
>
> My script didn't work in some cases and I eventually found that for v =
> 0 the test returned True
>
> So I changed my test for the obvious "if type(v) is bool"
[EMAIL PROTECTED] wrote:
> When I enter 'c' at the (Pdb) prompt it just goes to the next line, and
> doesn't "continue" as it should.
[...]
>
> Here's the sample output:
>
> S:\tmp>python epdb1.py
> --Return--
> > c:\python21\lib\pdb.py(895)set_trace()->None
> -> Pdb().set_trace()
[...]
Works for
Yves Glodt wrote:
> It does, I did like this:
>
> os.umask(0113)
> newpid =
> os.spawnl(os.P_NOWAIT,'/usr/local/bin/wine','/usr/local/bin/wine',executable)
>
> But I wanted to use spawnle and it's env argument, to avoid setting
> umask manually...
The umask is not part of the environment, so there
Nic Bar wrote:
> The problem with Jython is that I can only live inside the aplet
> virtual machine,
> I need a full features application with access to the local computer
> resources.
> Regarding IronPyhton, there is no released version yet.
> I am looking for something that can be used now and pl
Kent Johnson wrote:
> Is there a way to persist a class definition (not a class instance,
> the actual class) so it can be restored later? A naive approach
> using pickle doesn't work:
[snip]
> The idea is to persist classes that are created and modified at runtime.
I couldn't resist the challenge
Tin Gherdanarra wrote:
> typedef struct {
> PyObject_HEAD /* Here is the syntax error, and rightly so */
[snip]
> } PgConnection;
>
>
> I don't know what PyObject_HEAD or PGconn is,
> but if they are types, a syntax error is justified here:
>
> PyObject_HEAD /* Here is the syntax error *
Steve wrote:
> AJAX works because browsers can execute javascript. I don't know of a
> browser that can execute python. Basically your stuck with java or
> javascript because everything else really isn't cross platform
Don't jump to conclusions...
http://dwahler.ky/python/
If you really, really
Daniel Crespo wrote:
> I would like to know how can I do the PHP ternary operator/statement
> (... ? ... : ...) in Python...
>
> I want to something like:
>
> a = {'Huge': (quantity>90) ? True : False}
Well, in your example the '>' operator already returns a boolean value
so you can just use it di
Gabriel Zachmann wrote:
> It seems to me that the following behavior of python (2.4.1) is inconsistent:
[snip]
> Why was it implemented like this??
Lists are mutable objects; integers are not. For a list, a += b is
equivalent to a.__iadd__(b), which is an in-place modification.
For an integer, no
[EMAIL PROTECTED] wrote:
> I assume I have to use a header somewhere (import WConio ?).
If you had tried it, you would have discovered that "import WConio" is
exactly what you need. Don't be afraid to experiment!
-- David
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Is there some command in python so that I can read a key's input and
> then use a gotoxy() function to move the cursor on screen? e.g.:
> (psuedo-code)
>
> When the right arrow is pushed, cursor gotoxy(x+1,y)
>
> Thanks.
On Unix-like platforms, this functionality is pr
Lad wrote:
> Hi,
> I have a web program and a user can have access to a page only after he
> logged in.
> So, the program comes with a Login form and the user logins.But I do
> not know how to return the user back to where he came from, after a
> successful login.
>
> Something like this:
>
> Page
Tuvas wrote:
> Is there a way to stop a thread with some command like t.stop()? Or any
> other neat way to get around it? Thanks!
Sadly, no. While Java and many other programming languages have an
interrupt() primitive, Python does not. You can approximate this by
using a global variable to tell t
Ivan Sas wrote:
> I want to create some shareware program in Python. Can I distribute
> this program with
> python24.dll file from Python 2.4.2? I'm not sure if Python GPL
> compatible license allowing for doing it.
> Thanks,
> Ivan Sas
Python is distributed under its own license, not the GPL: s
[EMAIL PROTECTED] wrote:
> If what you want is a reversed copy, you could just append list1
> elements to list2, and use the reverse function such as
> >>> ...
> >>> for i in list1:
> ... list2.append(i)
> ...
> >>> list2.reverse()
> >>> list1
> ['1', '2', '3', '4', '5', '6', '7', '8', '9']
> >>>
[EMAIL PROTECTED] wrote:
> I want to use some old C code such as
> #define GEN_STREAMTYPE_NULL 0x51
> I need to send this to a server, but it must be declared as a unsigned
> four byte constant. I can not just send a string. I love python, but
> am looking for information where I
[EMAIL PROTECTED] wrote:
> hey there,
> i am using beautiful soup to parse a few pages (screen scraping)
> easy stuff.
> the issue i am having is with one particular web page that uses a
> javascript to display some numbers in tables.
>
> now if i open the file in mozilla and "save as" i get the nu
James Hu wrote:
> Hi, gurus,
>
> I would like to use ctypes to implement callback function for QImage
> Camera to capture image asynchronously, and I have the c++ code of
> callback, but I am totally in the dark, the ctypes tutorial is not good
> enough for me to do that, does someone know where t
Giovanni Bajo wrote:
> Hello,
>
> what's the magic needed to reuse the base-class implementation of a
> classmethod?
>
> class A(object):
>@classmethod
>def foo(cls, a,b):
># do something
>pass
>
> class B(A):
> @classmethod
> def foo(cls, a, b):
> A.foo(cl
David Mitchell wrote:
> Hi,
>
> I'm trying to get into the object oriented aspect of Python. If I create
> a custom class (in it's own file), how do I access that class in a
> function in a different file? In Java there's the notion of a CLASSPATH,
> where you can tell the compiler to look for cla
g.franzkowiak wrote:
> I start a process in my application with popen2.popen3('MyOtherProcess').
> That's ok, but what can I do if the other process is running ?
> Can I fetch some information and start with that ?
>
> gerd
It's not clear what you're asking for. Could you please clarify?
-- David
Gonnasi wrote:
> I want fetching some articles from nytimes.com for my Palm, and I want
> a clear, simple article too, my Palm has only 8M RAM.
>
> With the WGET, I can fetching the page like:
> "http://www.nytimes.com/2005/10/26/business/26fed.html?pagewanted=print";,
> and when WGET works, I can
Paul Dale wrote:
> Hi everyone,
>
> Is it possible to bind a list member or variable to a variable such that
>
> temp = 5
>
> list = [ temp ]
>
> temp == 6
>
> list
>
> would show
>
> list = [ 6 ]
>
> Thanks in advance?
>
> Paul
Python doesn't have "variables" -- a statement like "temp = 5" just
b
Sophia Cao wrote:
> Hello,
>
> I am seeking a python solution for my project. I am trying to
> implement an architecture where there is a server who receives incoming
> messages from several clients, then those messages need to be written
> to a MySQL database. To avoid too many connections to t
Operation Latte Thunder wrote:
> I have a simple test proggie that isn't behaving like I expect ( found
> below ). The script will infinitely run ( as expected ), but seems to
> completely ignore control-C's. Shouldn't the interpreter pass along
> KeyboardInterrupts and break out of the while loo
62 matches
Mail list logo