On 2008-01-11, tijo <[EMAIL PROTECTED]> wrote:
> Hi mate
> i created the socket and the connection with tcp and udp i dont know
> how to check the bytes send and time
> could you help me with this
Have a look at the time or timeit modules.
Albert
--
http://mail.python.org/mailman/listinfo/python
On Fri, 11 Jan 2008 01:48:43 -0500 Marty <[EMAIL PROTECTED]> wrote:
> Mike Meyer wrote:
> >> This caused me to wonder why Python does not have a "foreach" statement
> >> (and
> >> also why has it not come up in this thread)? I realize the topic has
> >> probably
> >> been beaten to death in ea
I am using a simple python webserver (see code below) to serve up
python scripts located in my cgi-bin directory.
import BaseHTTPServer
import CGIHTTPServer
class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
cgi_directories = ['/cgi-bin']
httpd = BaseHTTPServer.HTTPServer(('',8000), Handler)
On Jan 10, 10:36 pm, Marty <[EMAIL PROTECTED]> wrote:
> Hrvoje Niksic wrote:
> > Mike Meyer <[EMAIL PROTECTED]> writes:
>
> >> It sounds to me like your counter variable actually has meaning,
>
> > It depends how the code is written. In the example such as:
>
> > for meaningless_variable in xrange
Mike Meyer wrote:
> On Thu, 10 Jan 2008 22:36:56 -0500 Marty <[EMAIL PROTECTED]> wrote:
>> I recently faced a similar issue doing something like this:
>>
>> data_out = []
>> for i in range(len(data_in)):
>> data_out.append([])
>
> More succinctly:
>
> data_out = []
> for _
Hi all
i want to access a web page through python script, fillup the necessary
fields,
and press submit button (which does POST call) and retrieve the result page
and retrieve some values from it.
Here is the script i have written till now.
>import urllib2
> # create array of name/value pairs
> s
I'm printing out each entry in "gc.garbage" after a garbage collection in
DEBUG_LEAK mode, and I'm seeing many entries like
That's the output of "repr". Are "cell" objects created only from
external C libraries, or can regular Python code generate them? Is there
any way to find out what the '
"Ed Jensen" <[EMAIL PROTECTED]> wrote:
>
> Wow, this is pretty misleading.
>
> Java is, indeed, compiled to bytecode; however, modern JVMs typically
> compile the bytecode to native code and then execute the native code.
>
> CPython strictly interprets bytecode; it does not compile the
> bytecode
On Thu, 10 Jan 2008 22:36:56 -0500, Marty wrote:
> I recently faced a similar issue doing something like this:
>
> data_out = []
> for i in range(len(data_in)):
> data_out.append([])
>
> This caused me to wonder why Python does not have a "foreach" statement
> (and also why has it
Is it possible to load a script from it's text data, and not from a file?
I'm writing a scripting engine and need to run the scripts right from the
editor.
cheers!
--
Patrick Kidd Stinson
http://www.patrickkidd.com/
http://pkaudio.sourceforge.net/
http://pksampler.sourceforge.net/
--
http://mail
Mike Meyer <[EMAIL PROTECTED]> writes:
> data_out = [[] for _ in data_in]
> ...
> But I'm curious - what's the difference between the "foreach" you have
> in mind and the standard python "for"?
The "for" loop, like the list comprehension, pollutes the namespace
with an index variable that's not us
erik gartz <[EMAIL PROTECTED]> writes:
> The loop performs some actions with web services. The particular
> iteration I'm on isn't important to me. It is only important that I
> attempt the web services that number of times. If I succeed I
> obviously break out of the loop and the containing functi
On Jan 10, 10:36 pm, Marty <[EMAIL PROTECTED]> wrote:
> Hrvoje Niksic wrote:
> > Mike Meyer <[EMAIL PROTECTED]> writes:
>
> >> It sounds to me like your counter variable actually has meaning,
>
> > It depends how the code is written. In the example such as:
>
> > for meaningless_variable in xrange
Hi mate
i created the socket and the connection with tcp and udp i dont know
how to check the bytes send and time
could you help me with this
cheers
tijo
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 10, 10:46 am, Scott Sharkey <[EMAIL PROTECTED]>
wrote:
> Hello All,
>
> I am trying to write a python script to talk to an xml-based stock feed
> service. They are telling me that I must connect and login, and then
> "issue refresh requests" to fetch the data. This sounds a lot (to me)
> l
On Jan 10, 6:15 pm, tijo <[EMAIL PROTECTED]> wrote:
> Hi mate
>
> i need o do a python program to connect 2 systems using TCP/IP and
> UDP. Also i need to check the performance of these two protocols (how
> many bytes received and how much time took). I havent worked in python
> earlier and have no
On Thu, 10 Jan 2008 22:36:56 -0500 Marty <[EMAIL PROTECTED]> wrote:
> I recently faced a similar issue doing something like this:
>
> data_out = []
> for i in range(len(data_in)):
> data_out.append([])
More succinctly:
data_out = []
for _ in data_in:
data_out.append([])
Or, a
On Jan 10, 8:37 pm, Devraj <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> My Python program needs reliably detect which Operating System its
> being run on, infact it even needs to know which distribution of say
> Linux its running on. The reason being its a GTK application that
> needs to adapt its
On Thu, 10 Jan 2008 20:32:06 -0500 "Faber J. Fedor" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm in the process of learning Python by writing a job queue program.
> Nothing fancy, mind you, just read from a table, shell out to a program,
> write back to the table.
>
> I'm working off of the tuto
> On Behalf Of Marty
> I recently faced a similar issue doing something like this:
>
> data_out = []
> for i in range(len(data_in)):
> data_out.append([])
>
> This caused me to wonder why Python does not have a "foreach"
> statement (and also why has it not come up in this thread
Hrvoje Niksic wrote:
> Mike Meyer <[EMAIL PROTECTED]> writes:
>
>> It sounds to me like your counter variable actually has meaning,
>
> It depends how the code is written. In the example such as:
>
> for meaningless_variable in xrange(number_of_attempts):
> ...
>
> the loop variable really
Paul Rubin wrote:
> Tim Roberts <[EMAIL PROTECTED]> writes:
>
>> I have to say that I have found this to be a surprisingly common need as
>> well. Would this be an appropriate construct to add to itertools?
>>
>
> I'm in favor.
>
I am ecstatic about the idea of getting n items at a t
On Thu, 10 Jan 2008 18:37:59 -0800 (PST) Devraj <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> My Python program needs reliably detect which Operating System its
> being run on, infact it even needs to know which distribution of say
> Linux its running on. The reason being its a GTK application th
Raymond Hettinger <[EMAIL PROTECTED]> writes:
> > I presume you did scans of
> > large code bases and you did not find occurrences of
> > takewhile and dropwhile, right?
>
> Yes.
I think I have used them. I don't remember exactly how. Probably
something that could have been done more generally
Tim Roberts <[EMAIL PROTECTED]> writes:
> I have to say that I have found this to be a surprisingly common need as
> well. Would this be an appropriate construct to add to itertools?
I'm in favor.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 11 Jan 2008 13:09:26 +1100, Steve Brown wrote:
> What I'm trying to do with the tests is pare them back so that the code
> explicitly and concisely documents the tests.
Yes, this is good.
> It is important that the comments and doc strings NOT contain
> information about how Temperature
Hi Barry,
Obviously what you are trying to do is detect file locks. I am not
exactly sure how to do this in Python but from previous system
administration jobs here are some scenarios that you might want to
watch out for.
- I know for one that if you are accessing the file on a Samba share,
file
Hi everyone,
My Python program needs reliably detect which Operating System its
being run on, infact it even needs to know which distribution of say
Linux its running on. The reason being its a GTK application that
needs to adapt itself to be a Hildon application if run on devices
like the N800.
Sorry to diverge from the topic, but is there a reason you need to
develop something like again? I would assume that there would be
numerous utilities that would do this for you.
If you want these features in your applications, why don't you
consider incorporating existing tools/libraries into you
Fuzzyman <[EMAIL PROTECTED]> writes:
> STM isn't lock free - it just abstracts the locks away from the
> 'user'. You still need to lock around committing the transaction.
The idea is that readers don't need locks. They just look at the
version number before they start reading and after they finis
Aaron Watters <[EMAIL PROTECTED]> writes:
> The second one is! That's why it works so fast.
> Tim Peters optimized this case!
> Gotta hand it to Tim Peters. The first one should
> win some sort of obfuscated code contest, imho.
> It also seems to be 5 times slower than any of the others.
The hea
Hi mate
i need o do a python program to connect 2 systems using TCP/IP and
UDP. Also i need to check the performance of these two protocols (how
many bytes received and how much time took). I havent worked in python
earlier and have no idea of this. Could someone pls help me. I created
a program w
What I'm trying to do with the tests is pare them back so that
the code explicitly and concisely documents the tests.
It is important that the comments and doc strings NOT contain
information about how Temperature Sense works because that
is outside the scope of the test.
More generally, comments
"Neil Cerutti" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Jan 10, 2008 12:47 AM, Steve Brown <[EMAIL PROTECTED]> wrote:
>> I've got a series of modules which look like this:
>>
>> #
>> #
>> # Temperature Sense Test
>> #
>> #
>> class Test3(ar_test.AR_
Hi all,
I'm in the process of learning Python by writing a job queue program.
Nothing fancy, mind you, just read from a table, shell out to a program,
write back to the table.
I'm working off of the tutorial listed here (amongst many places):
http://www.devx.com/dbzone/Article/22093
In my Jobs c
Hi,
Can you please guide me for the following problem?
The call to "PyImport_ImportModule("cStringIO");" is failing with an error of
"undefined symbol: PyObject_SelfIter".
Before importing this module, I am importing only the sys module.
Py_SetProgramName("/usr/bin/python");
Py_Initialize(
[EMAIL PROTECTED] wrote:
> I'm reading this page:
> http://www.ps.uni-sb.de/~duchier/python/continuations.html
> and I've found a strange usage of lambda:
>
>
> Now, CPS would transform the baz function above into:
>
> def baz(x,y,c):
> mul(2,x,lambda v,y=y,c=c: add(
When running a doctest text file with doctest.testfile, I noticed that
universal newline support did not appear to work when module_relative
is False. My text file was saved on a Windows machine but I was
testing it on a Linux machine, hence the newline mismatch (doctest
would throw a SyntaxError f
On Jan 9, 10:55 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> erik gartz <[EMAIL PROTECTED]> writes:
> > The loop performs some actions with web services. The particular
> > iteration I'm on isn't important to me. It is only important that I
> > attempt the web services that number of times. If I suc
On Thu, 10 Jan 2008 14:55:18 -0800, [EMAIL PROTECTED] wrote:
> Can I access the class attributes from a method added at runtime? (My
> experience says no.)
> I experimented with the following code:
>
> [Code snipped]
>
> So it seems to me, if you add a method to an instance, the method will
> no
thanks Mike,
with your links I managed to write some code that seems to work well.
Still I stay surprised that these kind of functions are not available ;-)
cheers,
Stef
[EMAIL PROTECTED] wrote:
> On Jan 9, 3:22 pm, Stef Mientki <[EMAIL PROTECTED]> wrote:
>
>> hello,
>>
>> I'm trying to conver
Hi,
I just installed scons on win32 that has cygwin but uses ActiveState
python. If I do "import SCons", the lib isn't found.
The win32 installer seemed very complete, but the scons lib doesn't
seem to be in any dir python knows about.
Is there another install step I need to do?
TIA,
-T
--
http
On Jan 10, 12:36 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I've figured it out, it is default argument.
> print y()
> gives 13 as result.
>
> It's a bit evil though.
Why? It's the same syntax as with functions:
x=3
def y(x=x):
return x+10
print y(2) # prints 12
print y() # print
Can I access the class attributes from a method added at runtime? (My
experience says no.)
I experimented with the following code:
class myclass(object):
myattr = "myattr"
instance = myclass()
def method(x):
print x
instance.method = method
instance.method("hello world")
inst2 = myclas
You know you've been working at a large company for too long when you
see that subject and think "ISO-certified Python?"
Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 11, 8:46 am, "Adrian Wood" <[EMAIL PROTECTED]> wrote:
> Hi al! I'm new to the list, and reasonably new to Python, so be gentle.
>
> Long story short, I'm having a hard time finding a way to call a
> function on every object of a class at once.
A class is a factory that creates objects. It k
> l = []
> l.append(man)
> l.append(woman)
>
> # Print the state.
> for item in l:
> print item.state()
>
>
Small, off-topic nitpick:
please don't use "l" (lower-case el) as a variable name.
>From http://www.python.org/dev/peps/pep-0008/:
"Naming Conventions
Names to Avoid
Never use the cha
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:python-
> [EMAIL PROTECTED] On Behalf Of Adrian Wood
> Sent: Thursday, January 10, 2008 4:47 PM
> To: python-list@python.org
> Subject: Newbie question on Classes
>
>
> I can call man.state() and then woman.state() or Person.state(man
Fredrik Lundh wrote:
> > Adrian Wood wrote:
> >
> > I can call man.state() and then woman.state() or Person.state(man) and
> > Person.state(woman) to print the status of each. This takes time and
> > space however, and becomes unmanageable if we start talking about a
> > large number of objects, an
Kevin Walzer wrote:
> Here is an example of how I'm calling this in my code:
>
> from Macnotebook import Macnotebook
>
> self.prefbook = Macnotebook.notebook(self.prefframe)
> self.prefbook.pack(fill=BOTH, expand=YES, side=TOP)
you're attempting to call the method in a class
On Thu, 10 Jan 2008 22:32:50 +0100 Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> > Yes. For sure. I though XSLT was something like XML not other
> > "language" and that Python will have any library that uses XSLT to do
> > transformation...
> XSLT is definitely a language (it's turing complete, after
Adrian Wood wrote:
> I can call man.state() and then woman.state() or Person.state(man) and
> Person.state(woman) to print the status of each. This takes time and
> space however, and becomes unmanageable if we start talking about a
> large number of objects, and unworkable if there is an unknown
On Jan 10, 4:46 pm, "Adrian Wood" <[EMAIL PROTECTED]> wrote:
> Hi al! I'm new to the list, and reasonably new to Python, so be gentle.
>
> Long story short, I'm having a hard time finding a way to call a
> function on every object of a class at once. Example:
>
> I have a class Person, which has a
Thomas Troeger wrote:
> I've written a program that parses a string or file for embedded python
> commands, executes them and fills in the returned value. The input might
> look like this:
>
> process id: $$return os.getpid()$$
> current date: $$return time.ctime()$$
> superuser: $$
> if os.get
I'm trying to wrap a subset of a Tcl/Tk widget set called tclmacbag (see
http://tclmacbag.autons.net/) for use in my Tkinter application, using a
"macnotebook" class. I'm having some difficulty getting things
configured correctly.
Here is my class code:
from Tkinter import *
class Macnoteboo
On Jan 10, 2008 4:54 PM, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Adrian Wood wrote:
>
> > I can call man.state() and then woman.state() or Person.state(man) and
> > Person.state(woman) to print the status of each. This takes time and
> > space however, and becomes unmanageable if we start talki
Adrian Wood wrote:
> I can call man.state() and then woman.state() or Person.state(man) and
> Person.state(woman) to print the status of each. This takes time and
> space however, and becomes unmanageable if we start talking about a
> large number of objects, and unworkable if there is an unknown
Andrew Lonie wrote:
> Hi I noticed that the xpath functionality of elementtree has been
> upgraded in version 1.3. However I can't seem to get the [postion]
> predicate to function. All the other new functionality seems to be
> working.
ET 1.3 is only available in an early alpha yet, and the post
Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> oh, please. it was perfectly clear for anyone with the slightest clue
> what Bruno was talking about (especially if they'd read the post he was
> replying to), so the only question that remains is why you didn't
> understand it.
If you have something
Hi al! I'm new to the list, and reasonably new to Python, so be gentle.
Long story short, I'm having a hard time finding a way to call a
function on every object of a class at once. Example:
I have a class Person, which has a function state(). This prints a
basic string about the Person (position
Hi I noticed that the xpath functionality of elementtree has been
upgraded in version 1.3. However I can't seem to get the [postion]
predicate to function. All the other new functionality seems to be
working.
Maybe I'm getting the syntax wrong?:
>>> xml = ET.XML("""texttext2""")
>>> elem = xml.f
Florencio Cano wrote:
> Yes. For sure. I though XSLT was something like XML not other
> "language" and that Python will have any library that uses XSLT to do
> transformation...
XSLT is definitely a language (it's turing complete, after all), but
that there are of course several Python bindings
Steven W. Orr wrote:
> The problem only happens if I try to modify jj.
It only happens if you try to *bind* the name "jj" to an object inside
the function.
> What am I not understanding?
My guess is that you have a C/C++ view of variables and values, where
variables are locations in memory th
On Thursday 10 January 2008 22:42:44 Rob Wolfe wrote:
> Dimitrios Apostolou <[EMAIL PROTECTED]> writes:
> > On Thu, 10 Jan 2008, Rob Wolfe wrote:
> >> Dimitrios Apostolou <[EMAIL PROTECTED]> writes:
> >>> P.S. And something simpler: How can I disallow urllib2 to follow
> >>> redirections to foreign
Hi all,
I have thread that call a module which upload a file in a remote
repository.
A possible approach to calculate the time is tomonitor outgoing
traffic of that thread.
How can I do in python. There are modules usefull for this kind of
requests?
thank you all,
bye
w
--
http://mail.python.org
Ed Jensen wrote:
> The only question that remains is if you were being accidentally
> misleading or purposefully misleading.
oh, please. it was perfectly clear for anyone with the slightest clue
what Bruno was talking about (especially if they'd read the post he was
replying to), so the only q
On Wednesday, Jan 9th 2008 at 14:01 -, quoth Fredrik Lundh:
=>Steven W. Orr wrote:
=>
=>> So sorry because I know I'm doing something wrong.
=>>
=>> 574 > cat c2.py
=>> #! /usr/local/bin/python2.4
=>>
=>> def inc(jj):
=>> def dummy():
=>> jj = jj + 1
=>> return jj
=>>
Yes !
Where are the dogs ? I preffer them .. :-)
"Tim Churches" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> A challenge: an elegant, parsimonious and more general[1] implementation
of this, in Python:
>
> http://lol.ianloic.com/feed/www.planetpython.org/rss20.xml
>
> Tim
On Jan 10, 1:10 pm, Thomas Troeger <[EMAIL PROTECTED]>
wrote:
> Dear all,
>
> I've written a program that parses a string or file for embedded python
> commands, executes them and fills in the returned value. The input might
> look like this:
>
> process id: $$return os.getpid()$$
> current date: $
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> I fail to see how the existence of JIT compilers in some Java VM changes
> anything to the fact that both Java (by language specification) and
> CPython use the byte-code/VM scheme.
While your answer was technically correct, by omitting pertinent
Dimitrios Apostolou <[EMAIL PROTECTED]> writes:
> On Thu, 10 Jan 2008, Rob Wolfe wrote:
>
>> Dimitrios Apostolou <[EMAIL PROTECTED]> writes:
>>
>>> P.S. And something simpler: How can I disallow urllib2 to follow
>>> redirections to foreign hosts?
>>
>> You need to subclass `urllib2.HTTPRedirectHa
Hi,
I have a python program that constantly updates an excel spreadsheet.
I would like to be able to view its updates while using excel to edit
other excel files. Below are the test codes I have:
--
from time impo
2008/1/10, Fredrik Lundh <[EMAIL PROTECTED]>:
> Florencio Cano wrote:
>
> > I'm thinking about implementing a script in Python to do this task. I
> > have a XML log and logs from other programs. My aim is to do a report
> > about all this information. I'm thinking in using Python to transform
> > t
On Thu, 10 Jan 2008, Rob Wolfe wrote:
> Dimitrios Apostolou <[EMAIL PROTECTED]> writes:
>
>> P.S. And something simpler: How can I disallow urllib2 to follow
>> redirections to foreign hosts?
>
> You need to subclass `urllib2.HTTPRedirectHandler`, override
> `http_error_301` and `http_error_302` m
Florencio Cano wrote:
> I'm thinking about implementing a script in Python to do this task. I
> have a XML log and logs from other programs. My aim is to do a report
> about all this information. I'm thinking in using Python to transform
> the plain logs to XML and combine them with the XML docume
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> And the reference implementation of Python (CPython) is not
> interpreted, it's compiled to byte-code, which is then executed by a VM
> (just like Java).
Ed Jensen a écrit :
> Wow, this is pretty misleading.
Bruno Desthuilliers <[EMAIL PROTECTE
Hi!
I'm thinking about implementing a script in Python to do this task. I
have a XML log and logs from other programs. My aim is to do a report
about all this information. I'm thinking in using Python to transform
the plain logs to XML and combine them with the XML document I have
and later use som
Mike Meyer wrote:
What does "y=y" and "c=c" mean in the lambda function?
>>>
>>> Older versions of python didn't make variables in an outer scope
>>> visible in the inner scope. This was the standard idiom to work
>>> around that.
>>>
>> lexically scoped free variables and object binding are
On Thu, 10 Jan 2008 08:42:16 +0100 Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
> Mike Meyer <[EMAIL PROTECTED]> writes:
> > It sounds to me like your counter variable actually has meaning,
> It depends how the code is written. In the example such as:
>
> for meaningless_variable in xrange(number_of_
On Thu, 10 Jan 2008 19:59:23 +0100 Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Mike Meyer wrote:
> >> What does "y=y" and "c=c" mean in the lambda function?
> >
> > Older versions of python didn't make variables in an outer scope
> > visible in the inner scope. This was the standard idiom to work
>
Cédric Lucantis wrote:
> I can only load gif images with Tkinter.PhotoImage and none with BitmapImage.
> I tried png, jpg, bmp and xpm and always got this errors :
>
img = Tkinter.PhotoImage(file='/home/omer/fgfs/fgsync/map.xpm')
> Traceback (most recent call last):
> File "", line 1, in
Hello All,
I am trying to write a python script to talk to an xml-based stock feed
service. They are telling me that I must connect and login, and then
"issue refresh requests" to fetch the data. This sounds a lot (to me)
like HTTP 1.1 persistent connections. Can I do that with the urllib
f
On Jan 10, 3:37 am, Bruno Desthuilliers wrote:
> I fail to see how the existence of JIT compilers in some Java VM changes
> anything to the fact that both Java (by language specification) and
> CPython use the byte-code/VM scheme.
Because these "some Java VMs" with JIT compilers are the de facto
Mike Meyer wrote:
>> What does "y=y" and "c=c" mean in the lambda function?
>
> Older versions of python didn't make variables in an outer scope
> visible in the inner scope. This was the standard idiom to work
> around that.
lexically scoped free variables and object binding are two different
On Thu, 10 Jan 2008 10:25:27 -0800 (PST) "[EMAIL PROTECTED]" <[EMAIL
PROTECTED]> wrote:
> I'm reading this page:
> http://www.ps.uni-sb.de/~duchier/python/continuations.html
> and I've found a strange usage of lambda:
>
>
> Now, CPS would transform the baz function above in
[EMAIL PROTECTED] wrote:
>
> Now, CPS would transform the baz function above into:
>
> def baz(x,y,c):
> mul(2,x,lambda v,y=y,c=c: add(v,y,c))
>
> ###
>
> What does "y=y" and "c=c" mean in the lambda function?
they bind the argument "y" to the *obje
You're talking about syntax from the bad old days
when the scope rules were different.
If not too archeological for your tastes, download
and boot a 1.5 and see what happens.
Less empirically, here're some key references:
http://www.python.org/doc/2.2.3/whatsnew/node9.html
http://www.python.org/
I've figured it out, it is default argument.
print y()
gives 13 as result.
It's a bit evil though.
I hope this post will be useful some newbie like i'm now someday :)
On Jan 10, 7:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I'm reading this
> page:http://www.ps.uni-sb.de/~duchier/py
On Jan 10, 11:13 am, kj <[EMAIL PROTECTED]> wrote:
> I'm looking for "example implementations" of small projects in
> Python, similar to the ones given at the end of most chapters of
> The Perl Cookbook (2nd edition, isbn: 0596003137). (Unfortunately,
> the otherwise excellent Python Cookbook (2nd
> What does "y=y" and "c=c" mean in the lambda function?
the same thing it does in a function definition:
def myfunct(a, b=42, y=3.141):
pass
> #
> x = 3
> y = lambda x=x : x+10
>
> print y(2)
> ##
>
> It prints 12, so it doesn't bind the variable in th
On Jan 10, 1:01 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Wed, 9 Jan 2008 15:05:25 -0800 (PST), "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
> > Sometimes we spare the students (whomever they may be) this added
> > step and just hand them a di
Dimitrios Apostolou <[EMAIL PROTECTED]> writes:
> P.S. And something simpler: How can I disallow urllib2 to follow
> redirections to foreign hosts?
You need to subclass `urllib2.HTTPRedirectHandler`, override
`http_error_301` and `http_error_302` methods and throw
`urllib2.HTTPError` exception.
I'm reading this page:
http://www.ps.uni-sb.de/~duchier/python/continuations.html
and I've found a strange usage of lambda:
Now, CPS would transform the baz function above into:
def baz(x,y,c):
mul(2,x,lambda v,y=y,c=c: add(v,y,c))
###
What does "y=
Thomas Heller-2 wrote:
>
> Grant Edwards schrieb:
>
> [snip]
>
>>
>> Traceback (most recent call last):
>> File "surfedit.py", line 28, in ?
>> File "Gnuplot\_Gnuplot.pyc", line 178, in __init__
>> File "Gnuplot\gp_win32.pyc", line 117, in __init__
>> File "subprocess.pyc",
"Jack" <[EMAIL PROTECTED]> writes:
> I'm trying to use a proxy server with urllib2.
> So I have managed to get it to work by setting the environment
> variable:
> export HTTP_PROXY=127.0.0.1:8081
>
> But I wanted to set it from the code. However, this does not set the proxy:
> httpproxy = '127
A.T.Hofkamp wrote:
> Now the question you need to answer for yourself, is how much more worth is
> your own time compared to the gain in CPU time. If you think they are equal
> (ie
> the problem as a whole should be solved as fast as possible, thus the sum of
> development time + execution time s
On Jan 10, 12:59 am, BlackjadeLin <[EMAIL PROTECTED]> wrote:
> I'm new to python
> I want to write a simple script to switch user,for example,from user_A
> to user_B.
> This my codes:
>
> #!/usr/bin/python
> importpexpect
> import os
> passwd="user_B"
> child =pexpect.spawn('su user_B')
> child.exp
On Jan 10, 2008 9:24 AM, Riccardo Maria Bianchi
<[EMAIL PROTECTED]> wrote:
>
> Hello! :)
>
> I'm trying to run shell commands both with os.system() and
> subprocess.Popen() class.
>
> But I can't run aliases or function defined in my .bashrc file, like in
> the login interactive shell.
>
> Can you
Hello list,
I want to limit the download speed when using urllib2. In particular,
having several parallel downloads, I want to make sure that their total
speed doesn't exceed a maximum value.
I can't find a simple way to achieve this. After researching a can try
some things but I'm stuck on th
Have a look at Dive into Python by Mark Pilgrim. It is available for
free here http://www.diveintopython.org/.
Andy
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 169 matches
Mail list logo