J. Peng wrote:
> def safe_float(object):
> try:
> retval = float(object)
> except (ValueError, TypeError), oops:
> retval = str(oops)
> return retval
>
> x=safe_float([1,2,3,4])
> print x
>
>
> The code above works well.But what's the instance of "oops"? where is it
> coming from?
On 21 Jan, 22:00, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Jan 21, 2:52 pm, glomde <[EMAIL PROTECTED]> wrote:
>
>
>
> > On 21 Jan, 20:16, George Sakkis <[EMAIL PROTECTED]> wrote:
>
> > > On Jan 21, 1:56 pm, glomde <[EMAIL PROTECTED]> wrote:
>
> > > > On 21 Jan, 18:59, Wildemar Wildenburger
>
>
On Tue, 22 Jan 2008 15:36:49 +0800, J. Peng wrote:
> def safe_float(object):
> try:
> retval = float(object)
> except (ValueError, TypeError), oops:
> retval = str(oops)
> return retval
>
> x=safe_float([1,2,3,4])
> print x
>
>
> The code above works well.But what's the instance o
whatazor schrieb:
> Hi,
> how can I calulate transfer rate to a host , without using a file ?
> can ping module (written by Jeremy Hylton) be useful ?
You can't measure without transmitting data. It's not only the network
connection between the two hosts that is important, but also the sending
a
Hello,
I have this class:
class File:
def __init__(self):
self.name = ''
self.path = ''
self.date = 0
self.mod_date = 0
self.keywords = []
self.url = ''
...and after creating a list of File o
Robert Latest <[EMAIL PROTECTED]> writes:
> flist.sort(key=File.mod_date.toordinal)
>
> However, Python says:
> AttributeError: class File has no attribute 'mod_date'
The attribute is on instances of File, not on the class itself. See
if this works:
flist.sort(key=lambda f: f.mod_date.toordi
Hi Arnaud
> I've tried a completely different approach, that I imagine as 'folding'. I
> thought it would improve performance over my previous effort but extremely
> limited and crude benchmarking seems to indicate disappointingly comparable
> performance...
I wrote a stack-based version yesterd
J. Peng a écrit :
> def safe_float(object):
> try:
> retval = float(object)
> except (ValueError, TypeError), oops:
> retval = str(oops)
> return retval
> The code above works well.
For which definition of "works well" ?
This function is really ill-named - it returns either a float
Paul Rubin wrote:
> The attribute is on instances of File, not on the class itself. See
> if this works:
>
>flist.sort(key=lambda f: f.mod_date.toordinal)
It doesn't throw an error any more, but neither does it sort the list. This,
however, works:
--
def by_date(f1, f2):
MRAB a écrit :
> On Jan 21, 9:15 pm, Bruno Desthuilliers
> <[EMAIL PROTECTED]> wrote:
>> Arne a écrit :
(snip)
>>> So, I shouldn't use this techinicke (probably wrong spelled)
>> May I suggest "technic" ?-)
>
> That should be "technique"; just ask a Francophone! :-)
My bad :(
--
http://mail.py
Bruno Desthuilliers 写道:
> J. Peng a écrit :
>> def safe_float(object):
>> try:
>> retval = float(object)
>> except (ValueError, TypeError), oops:
>> retval = str(oops)
>> return retval
>
>> The code above works well.
>
> For which definition of "works well" ?
>
I got it from Core
Bart Ogryczak a écrit :
> On 2008-01-18, citizen Zbigniew Braniecki testified:
(snip usual default mutable list arg problem)
>> class A():
>>
>>def add (self, el):
>> self.lst.extend(el)
>>
>>def __init__ (self, val=[]):
>> print val
>> self.lst = val
>
> What you want proba
On Jan 22, 4:31 pm, Alnilam <[EMAIL PROTECTED]> wrote:
> Sorry for the noob question, but I've gone through the documentation
> on python.org, tried some of the diveintopython and boddie's examples,
> and looked through some of the numerous posts in this group on the
> subject and I'm still rather
Robert Latest wrote:
> Paul Rubin wrote:
>> The attribute is on instances of File, not on the class itself. See
>> if this works:
>>
>>flist.sort(key=lambda f: f.mod_date.toordinal)
>
> It doesn't throw an error any more, but neither does it sort the list. This,
> however, works:
>
> -
Hello,
I checked under linux and it works :
text.txt :
"first line of the text file
second line of the text file"
test.py :
"import sys
a = sys.stdin.readlines()
x = ''.join(a)
x = x.upper()
sys.stdout.write(x)"
>cat text.txt | python test.py
But I reinstalled Python 2.5 under Windows XP and i
Peter Otten wrote:
> Robert Latest wrote:
>
>> Paul Rubin wrote:
>>> The attribute is on instances of File, not on the class itself. See
>>> if this works:
>>>
>>>flist.sort(key=lambda f: f.mod_date.toordinal)
>>
>> It doesn't throw an error any more, but neither does it sort the list. This,
Bernard Desnoues wrote:
> Hello,
>
> I checked under linux and it works :
> text.txt :
> "first line of the text file
> second line of the text file"
>
> test.py :
> "import sys
> a = sys.stdin.readlines()
> x = ''.join(a)
> x = x.upper()
> sys.stdout.write(x)"
>
> >cat text.txt | python test.p
On Jan 22, 8:42 pm, Bernard Desnoues <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> I checked under linux and it works :
> text.txt :
> "first line of the text file
> second line of the text file"
>
> test.py :
> "import sys
> a = sys.stdin.readlines()
> x = ''.join(a)
> x = x.upper()
> sys.stdout.write(x
On Tue, 22 Jan 2008 09:56:55 +, Robert Latest wrote:
> Peter Otten wrote:
>> Robert Latest wrote:
>>
>> This should work then:
>>
>> def date_key(f):
>> return f.mod_date.toordinal()
>> flist.sort(key=date_key)
>>
>> This can also be written as
>>
>> flist.sort(key=lambda f: f.mod_date.too
J. Peng a écrit :
> Bruno Desthuilliers 写道:
>> J. Peng a écrit :
>>> def safe_float(object):
>>> try:
>>> retval = float(object)
>>> except (ValueError, TypeError), oops:
>>> retval = str(oops)
>>> return retval
>>> The code above works well.
>> For which definition of "works well" ?
In a class it is poosible to override setattr, so that you can decide
how you should
handle setting of variables.
Is this possible to do outside of an class on module level.
mysetattr(obj, var, value):
print "Hello"
So that
test = 5
would print
Hello
--
http://mail.python.org/mailman/listi
Hi,
Im using a MySQLdb connection with a DictCursor, and to me it seems the
wrapping to dictionaries only prepend column names when there is an actual
conflict in the keywords.
I would like the cursor to always prepend table names no matter what. Is this
possible?
Thanks,
-Frank
--
http://ma
glomde wrote:
> In a class it is poosible to override setattr, so that you can decide
> how you should
> handle setting of variables.
>
> Is this possible to do outside of an class on module level.
>
> mysetattr(obj, var, value):
> print "Hello"
>
> So that
>
> test = 5
>
>
> would print
>
On 22 Jan, 06:31, Alnilam <[EMAIL PROTECTED]> wrote:
> Sorry for the noob question, but I've gone through the documentation
> on python.org, tried some of the diveintopython and boddie's examples,
> and looked through some of the numerous posts in this group on the
> subject and I'm still rather co
On 2008-01-17, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> On Thu, 17 Jan 2008 11:40:59 +0800, J. Peng wrote:
>
>> May I ask, python's pass-by-reference is passing the object's reference
>> to functions, but perl, or C's pass-by-reference is passing the variable
>> itself's reference to functions.
Thomas Heller wrote:
> Helmut Jarausch schrieb:
>> Hi,
>>
>> how can I specify the paths to be searched for a dynamic library
>> to be loaded by ctypes' CDLL class on a Linux system.
>>
>> Do I have to set os.environment['LD_LIBRARY_PATH'] ?
>>
>
> ctypes passes the argument given to CDLL(path) st
I suppose my question should have been,
is there an obviously faster way?
Anyway, of the four ways below, the
first is substantially fastest. Is
there an obvious reason why?
Thanks,
Alan Isaac
PS My understanding is that the behavior
of the last is implementation dependent
and not guaranteed.
d
Robert Latest <[EMAIL PROTECTED]> writes:
> >flist.sort(key=lambda f: f.mod_date.toordinal)
>
> It doesn't throw an error any more, but neither does it sort the list. This,
> however, works:
Oh, I didn't realize that toordinal was a callable, given your earlier
sample. You want:
flist.s
Well, that's at least weird. I did test my code with Python 2.5 on Win
XP, using the command prompt. But testing it with IDLE gives exactly the
same error Bernard has. So apparently STDIN can't be accessed with IDLE.
Rolf
John Machin wrote:
>
> Excuse me, gentlemen, may I be your referee *befor
For a simple greenlet/tasklet/microthreading experiment I found myself in
the need to ask the question
isgenerator(v)
but didn't find any implementation in the usual suspects - builtins or
inspect.
I was able to help myself out with a simple (out of my head, hope its
def isgenerator(v):
def
Helmut Jarausch schrieb:
> Thomas Heller wrote:
>> Helmut Jarausch schrieb:
>>> Hi,
>>>
>>> how can I specify the paths to be searched for a dynamic library
>>> to be loaded by ctypes' CDLL class on a Linux system.
>>>
>>> Do I have to set os.environment['LD_LIBRARY_PATH'] ?
>>>
>>
>> ctypes passe
> Pardon me, but the standard issue Python 2.n (for n in range(5, 2,
> -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous
> 200-modules PyXML package installed. And you don't want the 75Kb
> BeautifulSoup?
I wasn't aware that I had PyXML installed, and can't find a reference
to
on 22.01.2008 14:20 Diez B. Roggisch said the following:
>
> def isgenerator(v):
> def _g(): yield
> return type(v) == type(_g())
>
> But I wonder why there is no such method already available?
This tests for generator objects, and you could also use::
return type(v) is types.Genera
On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]>
wrote:
>For a simple greenlet/tasklet/microthreading experiment I found myself in
>the need to ask the question
>
>isgenerator(v)
>
>but didn't find any implementation in the usual suspects - builtins or
>inspect.
>
>I was
Hi,
This is Windows bug that is described here:
http://support.microsoft.com/default.aspx?kbid=321788
This article also contains solution: you need to add registry value:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies
\Explorer
InheritConsoleHandles = 1 (REG_DWORD type)
Hi.
I'm new to Python and trying to use it to solve a specific problem. I
have an XML file in which I need to locate a specific text node and
replace the contents with some other text. The text in question is
actually about 70k of base64 encoded data.
I wrote some code that works on my Linux
> > The compile works, BUT linking fails:
>
> > 2.5\Release\psycopg\_psycopg.def -Lc:\python25\libs -Lc:
> > \python25\PCBuild -Lc:/p
> > ostgres/83RC2/lib -lpython25 -lpq -lws2_32 -ladvapi32 -o build
>
> > -Lc:/postgres/83RC2/lib
>
> Are you sure using forward slashes in the path works here?
Not
> I use psycopg2 all the time on windows. I use the binary installer
> instead of source. Works great for me.
>
> -Tom
Me2. Just in 7 out of 200 it does not work with the currently
available binary installer, on some startups, so I decided to follow a
recommendation out of the psycopg2 list to comp
Jean-Paul Calderone wrote:
> On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch"
> <[EMAIL PROTECTED]> wrote:
>>For a simple greenlet/tasklet/microthreading experiment I found myself in
>>the need to ask the question
>>
>>isgenerator(v)
>>
>>but didn't find any implementation in the usual suspe
Stefan Rank wrote:
> on 22.01.2008 14:20 Diez B. Roggisch said the following:
>>
>> def isgenerator(v):
>> def _g(): yield
>> return type(v) == type(_g())
>>
>> But I wonder why there is no such method already available?
>
>
> This tests for generator objects, and you could also use::
On Jan 22, 1:19 pm, Alan Isaac <[EMAIL PROTECTED]> wrote:
[...]
> PS My understanding is that the behavior
> of the last is implementation dependent
> and not guaranteed.
[...]
> def pairs4(x):
> xiter = iter(x)
> for x12 in izip(xiter,xiter):
> yield x12
According to the docs [1],
Hello,
Is there any idea how can i create (.exe) from application (.exe )
with py2exe?
Regards,
Vedran
--
http://mail.python.org/mailman/listinfo/python-list
Sorry, I meant:
Alternatively you can use following command
cat file | python script.py
instead of
cat file | script.py
On Jan 22, 1:54 pm, Konstantin Shaposhnikov <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> This is Windows bug that is described
> here:http://support.microsoft.com/default.asp
On Jan 21, 7:42 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Mon, 21 Jan 2008 22:02:34 -0200, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> escribió:
>
>
>
>
>
> > On Jan 21, 5:36 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
> >> [EMAIL PROTECTED] wrote:
> >> > How can I figure out the largest
[EMAIL PROTECTED] wrote:
> Is there any idea how can i create (.exe) from application (.exe )
> with py2exe?
yes. here [1], here [2] and maybe here [3].
bye.
http://catb.org/~esr/faqs/smart-questions.html [1]
http://www.google.com [2]
http://www.py2exe.org [3]
--
http://mail.python.org/mailman/li
Jean-Paul Calderone wrote:
> On Tue, 22 Jan 2008 15:15:43 +0100, "Diez B. Roggisch"
> <[EMAIL PROTECTED]> wrote:
>>Jean-Paul Calderone wrote:
>>
>>> On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch"
>>> <[EMAIL PROTECTED]> wrote:
For a simple greenlet/tasklet/microthreading experiment I f
The first stable/production version of pyglet has been released.
http://www.pyglet.org
---
pyglet provides an object-oriented programming interface for
developing games and other visually-rich applications for Windows, Mac
OS X and Linux. Some of the features of pyglet are:
* No external de
On Tue, 22 Jan 2008 15:15:43 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]>
wrote:
>Jean-Paul Calderone wrote:
>
>> On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch"
>> <[EMAIL PROTECTED]> wrote:
>>>For a simple greenlet/tasklet/microthreading experiment I found myself in
>>>the need to ask th
On Jan 22, 7:44 am, Alnilam <[EMAIL PROTECTED]> wrote:
> ...I move from computer to
> computer regularly, and while all have a recent copy of Python, each
> has different (or no) extra modules, and I don't always have the
> luxury of downloading extras. That being said, if there's a simple way
> of
On Jan 22, 7:46 am, Stefan Rank <[EMAIL PROTECTED]> wrote:
> I also need to test for generator functions from time to time for which
> I use::
>
> def _isaGeneratorFunction(func):
> '''Check the bitmask of `func` for the magic generator flag.'''
> return bool(func.func_code.co_flag
I'm using subprocess.Popen() to create a child process. The child process is
inheriting the parent process' open sockets, but I don't want that. I believe
that on Unix systems I could use the FD_CLOEXEC flag, but I'm running Windows.
Any suggestions?
--
http://mail.python.org/mailman/listinfo/p
On Jan 22, 8:11 am, John Carlyle-Clarke <[EMAIL PROTECTED]> wrote:
> Hi.
>
> I'm new to Python and trying to use it to solve a specific problem. I
> have an XML file in which I need to locate a specific text node and
> replace the contents with some other text. The text in question is
> actually
Stefan Rank wrote:
> on 22.01.2008 14:20 Diez B. Roggisch said the following:
>> def isgenerator(v):
>> def _g(): yield
>> return type(v) == type(_g())
>>
>> But I wonder why there is no such method already available?
>
>
> This tests for generator objects, and you could also use::
>
>
On Tue, 22 Jan 2008 15:52:02 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]>
wrote:
>Jean-Paul Calderone wrote:
>
> [snip]
>>
>> Sorry, I still don't understand. Why is a generator different from any
>> other iterator?
>
>Because you can use send(value) on it for example. Which you can't with
>ever
Alan Isaac>What is the fastest way? (Ignore the import time.)<
Maybe someday someone will realize such stuff belongs to the python
STD lib...
If you need a lazy generator without padding, that splits starting
from the start, then this is the faster to me if n is close to 2:
def xpartition(seq, n
on 22.01.2008 16:09 Paul McGuire said the following:
> On Jan 22, 7:46 am, Stefan Rank <[EMAIL PROTECTED]> wrote:
>> I also need to test for generator functions from time to time for which
>> I use::
>>
>>def _isaGeneratorFunction(func):
>>'''Check the bitmask of `func` for the magic ge
> In fact you have *two* threads: the main thread, and the one you create
> explicitly.
> After you start the clock thread, the main thread continues executing,
> immediately entering the finally clause.
> If you want to wait for the other thread to finish, use the join() method.
> But I'm unsure
Arnaud Delobelle wrote:
> According to the docs [1], izip is defined to be equivalent to:
>
> def izip(*iterables):
> iterables = map(iter, iterables)
> while iterables:
> result = [it.next() for it in iterables]
> yield tuple(result)
>
> This guar
On Jan 22, 1:19 pm, Alan Isaac <[EMAIL PROTECTED]> wrote:
> I suppose my question should have been,
> is there an obviously faster way?
> Anyway, of the four ways below, the
> first is substantially fastest. Is
> there an obvious reason why?
Can you post your results?
I get different ones (pairs
On Jan 22, 9:11 am, John Carlyle-Clarke <[EMAIL PROTECTED]> wrote:
> By the way, is pyxml a live project or not? Should it still be used?
> It's odd that if you go tohttp://www.python.org/and click the link
> "Using python for..." XML, it leads you tohttp://pyxml.sourceforge.net/topics/
>
> If yo
On Jan 22, 8:44 am, Alnilam <[EMAIL PROTECTED]> wrote:
> > Pardon me, but the standard issue Python 2.n (for n in range(5, 2,
> > -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous
> > 200-modules PyXML package installed. And you don't want the 75Kb
> > BeautifulSoup?
>
> I wasn'
On Jan 22, 6:20 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> For a simple greenlet/tasklet/microthreading experiment I found myself in
> the need to ask the question
>
> isgenerator(v)
>
> but didn't find any implementation in the usual suspects - builtins or
> inspect.
types.GeneratorType
On Jan 22, 4:10 pm, Alan Isaac <[EMAIL PROTECTED]> wrote:
> http://bugs.python.org/issue1121416>
>
> fwiw,
> Alan Isaac
Thanks. So I guess I shouldn't take the code snippet I quoted as a
specification of izip but rather as an illustration.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/
On 1/21/2008 9:02 AM, Bernard Desnoues wrote:
> Hi,
>
> I've got a problem with the use of Redmon (redirection port monitor). I
> intend to develop a virtual printer so that I can modify data sent to
> the printer.
FWIW: there is a nice update the RedMon (v1.7) called RedMon EE (v1.81)
availab
On 22 Jan, 15:11, John Carlyle-Clarke <[EMAIL PROTECTED]> wrote:
>
> I wrote some code that works on my Linux box using xml.dom.minidom, but
> it will not run on the windows box that I really need it on. Python
> 2.5.1 on both.
>
> On the windows machine, it's a clean install of the Python .msi fr
Alnilam wrote:
> On Jan 22, 8:44 am, Alnilam <[EMAIL PROTECTED]> wrote:
>> > Pardon me, but the standard issue Python 2.n (for n in range(5, 2,
>> > -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous
>> > 200-modules PyXML package installed. And you don't want the 75Kb
>> > Beau
On 1/22/2008 8:54 AM, Konstantin Shaposhnikov wrote:
> Hi,
>
> This is Windows bug that is described here:
> http://support.microsoft.com/default.aspx?kbid=321788
>
> This article also contains solution: you need to add registry value:
>
> HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVe
Hi,
I need to parse a fairly complex HTML page that has XML embedded in
it. I've done parsing before with the xml.dom.minidom module on just
plain XML, but I cannot get it to work with this HTML page.
The XML looks like this:
Owner
1
07/16/2007
No
Doe, John
1905 S
On Jan 22, 1:23 am, Joel <[EMAIL PROTECTED]> wrote:
> Can you please tell me how this can be done..
> are there any other IDEs for the same purpose if Boa can't do it?
>
> Joel
>
> On Jan 6, 11:01 am, Joel <[EMAIL PROTECTED]> wrote:
>
> > Hey there..
> > I'm using boa constructor to debug a python
On 2008-01-22, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> In fact you have *two* threads: the main thread, and the one you create
>> explicitly.
>
>> After you start the clock thread, the main thread continues executing,
>> immediately entering the finally clause.
>> If you want to wait for th
Hi I really need help. I've been looking around for an answer forever.
I need to submit a form with no name and also the submit button has no
name or value. How might I go about doing either of these. Thanks
--
http://mail.python.org/mailman/listinfo/python-list
Hello
I'm using debian linux, Python 2.4.4, and utidylib (http://
utidylib.berlios.de/). I wrote simple functions to get a web page,
convert it from windows-1251 to utf8 and then I'd like to clean html
with it.
Here is two pages I use to check my program:
http://www.ya.ru/ (in this case everythin
On 22 Jan, 17:57, Mike Driscoll <[EMAIL PROTECTED]> wrote:
>
> I need to parse a fairly complex HTML page that has XML embedded in
> it. I've done parsing before with the xml.dom.minidom module on just
> plain XML, but I cannot get it to work with this HTML page.
It's HTML day on comp.lang.python
Diez B. Roggisch wrote:
> Jean-Paul Calderone wrote:
>
>> On Tue, 22 Jan 2008 15:15:43 +0100, "Diez B. Roggisch"
>> <[EMAIL PROTECTED]> wrote:
>>> Jean-Paul Calderone wrote:
>>>
On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch"
<[EMAIL PROTECTED]> wrote:
> For a simple greenlet/
I'm starting with Python. First with some interactive things,
working through the tutorial,
then with definitions in a file called sudoku.py.
Of course I make lots of mistakes, so I have to include that file
time and again.
I discovered (the hard way) that the second time you invoke
from sudok
Arnaud Delobelle wrote:
> pairs4 wins.
Oops. I see a smaller difference,
but yes, pairs4 wins.
Alan Isaac
import time
from itertools import islice, izip
x = range(51)
def pairs1(x):
return izip(islice(x,0,None,2),islice(x,1,None,2))
def pairs2(x):
xiter = iter(x)
while True:
Albert van der Horst schrieb:
> I'm starting with Python. First with some interactive things,
> working through the tutorial,
> then with definitions in a file called sudoku.py.
> Of course I make lots of mistakes, so I have to include that file
> time and again.
>
> I discovered (the hard way) th
Howdy, I've been using rpy (1.0.1) and python (2.5.1) on my office
computer with great success. When I went to put rpy on my laptop,
however, I get an error trying to load rpy.
"Unable to determine R version from the registry. Trying another
method."
followed by a few lines of the usual error me
hello all,
I have a bit of a confusing question.
firstly I wanted a library which can do an svn like diff with two files.
let's say I have file1 and file2 where file2 contains some thing which
file1 does not have. now if I do readlines() on both the files, I
have a list of all the lines.
I now wan
On Jan 22, 2008 1:38 PM, hrochonwo <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to print string without "decoding" escaped characters to
> newline etc.
> like print "a\nb" -> a\nb
> is there a simple way to do it in python or should i somehow use
> string.replace(..) function ?
>>> print 'a\nb'.enc
On Jan 22, 6:34 pm, Paddy <[EMAIL PROTECTED]> wrote:
[...]
> Hi George,
> You need to 'get it right' first. Micro optimizations for speed
> without thought of the wider context is a bad habit to form and a time
> waster.
> If the routine is all that needs to be delivered and it does not
> perform a
On Jan 22, 7:58 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote:
> On Jan 22, 2008 1:38 PM, hrochonwo <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I want to print string without "decoding" escaped characters to
> > newline etc.
> > like print "a\nb" -> a\nb
> > is there a simple way to do it in python or
On Jan 22, 5:34 am, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Jan 22, 12:15 am, Paddy <[EMAIL PROTECTED]> wrote:
>
> > On Jan 22, 3:20 am, Alan Isaac <[EMAIL PROTECTED]> wrote:> I want to
> > generate sequential pairs from a list.
> > <>
> > > What is the fastest way? (Ignore the import time.)
Hi,
I want to print string without "decoding" escaped characters to
newline etc.
like print "a\nb" -> a\nb
is there a simple way to do it in python or should i somehow use
string.replace(..) function ?
thanks for any reply
hrocho
--
http://mail.python.org/mailman/listinfo/python-list
This has to be easier than I'm making it
I've got a module, remote.py, which contains a number of classes, all
of whom open a port for communication. I'd like to have a way to
coordinate these port numbers akin to this:
So I have this in the __init__.py file for a package called cstore:
nex
I'm still learning Python and was wanting to get some thoughts on this. I
apologize if this sounds ridiculous... I'm mainly asking it to gain some
knowledge of what works better. The main question I have is if I had a lot of
lists to choose from, what's the best way to write the code so I'm n
Bret <[EMAIL PROTECTED]> writes:
> nextport=42000
>
> def getNextPort():
> nextport += 1
> return nextport
If you have to do it that way, use:
def getNextPort():
global nextport
nextport += 1
return nextport
the global declaration stops the compiler from trea
Arnaud Delobelle wrote:
> On Jan 22, 4:10 pm, Alan Isaac <[EMAIL PROTECTED]> wrote:
>
>> http://bugs.python.org/issue1121416>
>>
>> fwiw,
>> Alan Isaac
>
> Thanks. So I guess I shouldn't take the code snippet I quoted as a
> specification of izip but rather as an illustration.
You can be bolde
Paul McGuire wrote:
>
> Here is a pyparsing hack for your problem.
Thanks Paul! This looks like an interesting approach, and once I get my
head around the syntax, I'll give it a proper whirl.
--
http://mail.python.org/mailman/listinfo/python-list
Since you aren't familyer with classes i will keep this within the
scope of functions... If you have code like this
def a():
def b():
a+=1
Then you can only call function b when you are within function a
James
On Jan 22, 2008 8:58 PM, <[EMAIL PROTECTED]> wrote:
> I'm still learning Pyt
Greg Johnston wrote:
> Hey all,
>
> I'm a relative newbie to Python (switched over from Scheme fairly
> recently) but I've been using PyGTK and Glade to create an interface,
> which is a combo I'm very impressed with.
>
> There is, however, one thing I've been wondering about. It doesn't
> seem p
On Jan 22, 7:58 pm, <[EMAIL PROTECTED]> wrote:
> I'm still learning Python and was wanting to get some thoughts on this. I
> apologize if this sounds ridiculous... I'm mainly asking it to gain some
> knowledge of what works better. The main question I have is if I had a lot
> of lists to choo
[Peter Otten]
> You can be bolder here as the izip() docs explicitly state
>
> """
> Note, the left-to-right evaluation order of the iterables is
> guaranteed. This makes possible an idiom for clustering a data series into
> n-length groups using "izip(*[iter(s)]*n)".
> """
. . .
> is about zip(),
> def albumInfo(theBand):
> def Rush():
> return ['Rush', 'Fly By Night', 'Caress of Steel',
'2112', 'A Farewell to Kings', 'Hemispheres']
>
> def Enchant():
> return ['A Blueprint of the World', 'Wounded', 'Time Lost']
>
> The only problem with the code above though is that
On Jan 21, 11:13 pm, Dan Stromberg <[EMAIL PROTECTED]> wrote:
> On Thu, 17 Jan 2008 18:18:53 -0800, Raymond Hettinger wrote:
> >> >> I keep wanting something like them - especially bags with something
> >> >> akin to set union, intersection and difference.
>
> >> > How about this recepie
> >> > htt
On Jan 22, 11:32 am, Paul Boddie <[EMAIL PROTECTED]> wrote:
> > The rest of the document is html, javascript div tags, etc. I need the
> > information only from the row where the Relationship tag = Owner and
> > the Priority tag = 1. The rest I can ignore. When I tried parsing it
> > with minidom,
Hi there :)
A little tip upfront: In the future you might want to come up with a
more descriptive subject line. This will help readers decide early if
they can possibly help or not.
[EMAIL PROTECTED] wrote:
> def albumInfo(theBand):
> def Rush():
> return ['Rush', 'Fly By Night', 'C
On 2008-01-22, citizen Bruno Desthuilliers testified:
>> from copy import copy
>> ### see also deepcopy
>> self.lst = copy(val)
>
> What makes you think the OP wants a copy ?
I´m guessing he doesn´t want to mutate original list, while
On Jan 22, 11:39 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Alnilam wrote:
> > On Jan 22, 8:44 am, Alnilam <[EMAIL PROTECTED]> wrote:
> >> > Pardon me, but the standard issue Python 2.n (for n in range(5, 2,
> >> > -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous
> >>
Mike Driscoll wrote:
> On Jan 17, 3:56 pm, Stef Mientki <[EMAIL PROTECTED]> wrote:
>
>> hello,
>>
>> I've a program (not written in Python) that generates a few thousands
>> bytes per second,
>> these files are dumped in 2 buffers (files), at in interval time of 50 msec,
>> the files can be read
1 - 100 of 154 matches
Mail list logo