Andreas Waldenburger wrote:
On Fri, 26 Feb 2010 09:09:36 -0600 Tim Daneliuk
wrote:
On 2/24/2010 2:23 PM, Andreas Waldenburger wrote:
[stuff]
Reminiscent of:
mov AX,BX ; Move the contents of BX into AX
Well, there might be some confusion there as to what
Roy Smith wrote:
In article ,
Tim Daneliuk wrote:
On 2/24/2010 2:23 PM, Andreas Waldenburger wrote:
Hi all,
a company that works with my company writes a lot of of their code in
Python (lucky jerks). I've seen their code and it basically looks like
this:
"""Function that does stuff
MRAB wrote:
Gregory Ewing wrote:
Mel wrote:
You could think of it as a not bad use of the design principle
"Clear The Simple Stuff Out Of The Way First". Destinations are
commonly a lot simpler than sources
That's not usually true in assembly languages, though,
where the source and destina
Gabor Urban wrote:
Hi guys,
I am building a nested data structure with the following compontens:
<>
class Item:
def __init__(self, pId, pChange, pComment):
self.ID = pId
self.Delta = pChange
self.Comment = pComment
def PrintItem(self):
str = '%s,%s,%s'%
Andreas Waldenburger wrote:
On Tue, 02 Mar 2010 03:18:30 +1100 Lie Ryan wrote:
On 03/02/10 00:09, Andreas Waldenburger wrote:
On Mon, 1 Mar 2010 05:01:49 -0800 (PST) alex23
wrote:
Andreas Waldenburger wrote:
But as I said: a) I am (we are) not in a position to imp
Roy Smith wrote:
>From inside a module, I want to add a key-value pair to the module's
__dict__. I know I can just do:
FOO = 'bar'
at the module top-level, but I've got 'FOO' as a string and what I
really need to do is
__dict__['Foo'] = 'bar'
When I do that, I get "NameError: name '__dict__'
Andreas Waldenburger wrote:
On Tue, 02 Mar 2010 09:48:47 +1100 Ben Finney
wrote:
It's not our concern.
Then I don't see what that problem is.
There is none. I was griping about how stupid they are. That is a
personal problem I have with their *code* (not software), and I tho
Wanderer wrote:
On Mar 3, 2:33 pm, Robert Kern wrote:
On 2010-03-03 11:39 AM, Wanderer wrote:
Pylint W0221 gives the warning
Argument number differs from overridden method.
Why is this a problem? I'm overriding the method to add additional
functionality.
There are exce
Alf P. Steinbach wrote:
From your post, the scope guard technique is used "to ensure some
desired cleanup at the end of a scope, even when the scope is exited
via an exception." This is precisely what the try: finally: syntax is
for.
You'd have to nest it. That's ugly. And more importantly,
Alf P. Steinbach wrote:
* Jean-Michel Pichavant:
Alf P. Steinbach wrote:
From your post, the scope guard technique is used "to ensure some
desired cleanup at the end of a scope, even when the scope is
exited via an exception." This is precisely what the try: finally:
syntax is for
Michael Rudolf wrote:
Am 04.03.2010 17:32, schrieb Jean-Michel Pichavant:
It looks like to me that 'with' statements are like decorators:
overrated.
Oh no, you just insulted my favourite two python features, followed
immediately by generators, iterators and list comprehensions /
Pete Emerson wrote:
I've written my first python program, and would love suggestions for
improvement.
I'm a perl programmer and used a perl version of this program to guide
me. So in that sense, the python is "perlesque"
This script parses /etc/hosts for hostnames, and based on terms given
on t
Robert Kern wrote:
On 2010-03-04 15:12 , Mike Kent wrote:
On Mar 4, 12:30 pm, Robert Kern wrote:
He's ignorant of the use cases of the with: statement, true.
Ouch! Ignorant of the use cases of the with statement, am I?
Odd, I use it all the time.
No, I was referring to Jean-M
Duncan Booth wrote:
Jean-Michel Pichavant wrote:
You've already been given good advices.
Unlike some of those, I don't think using regexp an issue in any way.
Yes they are not readable, for sure, I 100% agree to that statement, but
you can make them readable very easily.
# no
Kamil Wasilewski wrote:
Hi,
Ive got an issue where a variable name needs to have a minus sign (-) in it.
#Python 2.6
from SOAPpy import WSDL
wsdlFile = "http://webapi.allegro.pl/uploader.php?wsdl";
server = WSDL.Proxy(wsdlFile)
server.soapproxy.config.argsOrdering = {'doGetCountries': ['country
Steven D'Aprano wrote:
On Fri, 05 Mar 2010 18:14:16 +0100, mk wrote:
isinstance(False, int)
True
>>>
>>> isinstance(True, int)
True
Huh?
Yes. Do you have an actual question?
>>> issubclass(bool, int)
True
Huh?!
Exactly.
Bools are a late-comer to Python.
Pete Emerson wrote:
On Mar 5, 1:14 pm, Chris Rebert wrote:
On Fri, Mar 5, 2010 at 12:25 PM, Pete Emerson wrote:
On Fri, Mar 5, 2010 at 12:17 PM, Chris Rebert wrote:
On 3/5/10, Pete Emerson wrote:
In a module, how do I create a conditional that will do something
bas
Johny wrote:
I have this directory structure
C:
\A
__init__.py
amodule.py
\B
__init__.py
bmodule.py
\D
__init__.py
dmodule.py
and I want to import bmodule.py
C:\>cd \
C:\>python
Python 2.5 (r25:51908, S
News123 wrote:
Jean-Michel Pichavant wrote:
Johny wrote:
I have this directory structure
C:
\A
__init__.py
amodule.py
\B
__init__.py
bmodule.py
\D
__init__.py
dmodule.py
and I want to import
Daniel Klein wrote:
Hey,
I did a little searching and couldn't really find much recent on this.
The only thing I found was this:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/a696624c92b91181/5b7479fdc3362b83?lnk=gst&q=break+named+loop#5b7479fdc3362b83
Basically I'm wond
Lars Stavholm wrote:
Hi all,
has anyone managed to integrate pexpect and logging?
I.e., I'd like to be able to pick up the dialog,
commands sent and responses received, in my logging.
I know about the pexpect logfile, and I can log things
to stdout or stderr, but I really need to log using the
JEHERUL wrote:
Dear All
I am trying to telnet to a Cisco router . Following is my code .
#code router.py
import getpass
import sys
import telnetlib
HOST = "router address" # router address is ommitted for
security reason
user = raw_input("Username : ")
password = getpass.getpa
Hellmut Weber wrote:
Hi Vinay Sajip,
I'm very glad discoverd your logging module ;-)
(That's what I would have liked 25 years ago when I was working as a
technical software developper!)
Now I'm writing just some personal tools, I like python and want to
use logging on a regular basis.
Loggi
PEYMAN ASKARI wrote:
Hello
I need some help dynamically reloading modules. As it turns out, it is
not as simple as calling reload, as outlined here
http://pyunit.sourceforge.net/notes/reloading.html
Is there builtin support for this? The example they gave does not seem
to work for me, and I
News123 wrote:
Jonathan Gardner wrote:
On Thu, Mar 11, 2010 at 6:57 AM, gb345 wrote:
And even when we've had volunteers, hardly anyone shows up!
Any suggestions would be appreciated.
Two things: One, only you and your friend really care. Let that sink
in. No one is going to c
Luis M. González wrote:
On Mar 12, 10:59 am, hiral wrote:
Hi,
Is there any way to create variables which name matches with dict key?
For example:
dict1 = {"abc":'1", "def":"2"}
Now I am looking to have variable name abc and it's value be '1' etc.
Pl. suggest.
Thank you.
Check out
JLundell wrote:
I've got a subclass of fractions.Fraction called Value; it's a mostly
trivial class, except that it overrides __eq__ to mean 'nearly equal'.
However, since Fraction's operations result in a Fraction, not a
Value, I end up with stuff like this:
x = Value(1) + Value(2)
where x is
Am Montag, den 15.03.2010, 05:42 -0700 schrieb Michael.Lausch:
On Mar 15, 11:40 am, Steven D'Aprano wrote:
On Mon, 15 Mar 2010 01:43:02 -0700, Michael.Lausch wrote:
Hi,
I managed to get confused by Python, which is not such an easy task.
The problem i have is root
Steve Holden wrote:
pyt...@bdurham.com wrote:
Any reason you prefer PDB over WinPDB?
http://winpdb.org/
Yes. I don't have Windows except one one PC :P
WinPDB runs on non-Windows platforms :)
One might reasonably argue that it has a pretty couter-intuitive name, then.
vsoler wrote:
Hello,
I am still learning python, thus developnig small scripts.
Some of them consist only of the main module. While testing them
(debugging) I sometimes want to stop the script at a certain point,
with something likestop, break, end or something similar.
What statement ca
Jean-Michel Pichavant wrote:
vsoler wrote:
Hello,
I am still learning python, thus developnig small scripts.
Some of them consist only of the main module. While testing them
(debugging) I sometimes want to stop the script at a certain point,
with something likestop, break, end or
samb wrote:
Hi,
I've found a work around, inspired from Rob Williscroft :
class ReMatch(object):
"""
Object to be called :
1st time : do a regexp.match and return the answer (args:
regexp, line)
2nd time : return the previous result (args: prev)
"""
def __cal
Hellmut Weber wrote:
Am 11.03.2010 12:14, schrieb Peter Otten:
Hellmut Weber wrote:
Logging works very well giving the filename and line number of the
point
where it is called. As long as I use the loggers directly.
BUT when I have to wrap the logger call in some other function, I
always
ge
Peter Otten wrote:
Jean-Michel Pichavant wrote:
Hellmut Weber wrote:
Am 11.03.2010 12:14, schrieb Peter Otten:
Hellmut Weber wrote:
Logging works very well giving the filename and line number of the
point
where it is called. As long as I use the loggers directly
Spencer Pearson wrote:
Hi!
This might be more of a personal-preference question than anything,
but here goes: when is it appropriate for a function to take a list or
tuple as input, and when should it allow a varying number of
arguments? It seems as though the two are always interchangeable. For
News123 wrote:
Hi,
I wondered about the best way, that a module's function could determine
the existance and value of variables in the __main__ module.
What I came up with is:
### main.py ##
import mod
A = 4
if __name__ == "__main__": mod.f()
### mod.py ##
def
kj wrote:
I have a list of items L, and a test function is_invalid that checks
the validity of each item. To check that there are no invalid
items in L, I could check the value of any(map(is_invalid, L)).
But this approach is suboptimal in the sense that, no matter what
L is, is_invalid will be
kj wrote:
Arguably, Knuth's "premature optimization is the root of all evil"
applies even to readability (e.g. "what's the point of making code
optimally readable if one is going to change it completely next
day?")
The guy who will change it will have to read it. The only waste would be
if the
Peter Otten wrote:
Vinay Sajip wrote:
Sorry I'm a little late to this discussion. I could add a _findCaller
function to the module (not part of the public API, but replaceable by
someone who really needs to) which does the heavy lifting, and
Logger.findCaller just calls it. Then those who ne
C. B. wrote:
Hi everyone,
I'm currently coding a C library which provides several modules and
objects.
Let's say that some of these objects are classes called AAA and BBB.
The constructor of AAA needs to get BBB as argument.
So I can run the following code :
from mymodule import AAA
from mymo
Ovidiu Deac wrote:
Then I tried this:
file = logging.FileHandler(logFileBasename, 'w')
file.setLevel(logging.INFO)
# set a format which is simpler for console use
formatter = logging.Formatter('%(asctime)s %(name)-12s
%(levelname)-8s %(message)s',)
# tell the handler to use th
Ovidiu Deac wrote:
You set le level of your handler, but did not set the level of the logger
itself.
Replace file.setLevel(logging.INFO) by
logging.getLogger().setLevel(logging.INFO)
Log events are matched versus the logger level 1st, then the handler level
(if applicable). Most of the time you
kj wrote:
What's the word on using "classes as namespaces"? E.g.
class _cfg(object):
spam = 1
jambon = 3
huevos = 2
breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos)
Granted, this is not the "intended use" for classes, and therefore
could be viewed as a misuse ("that's what dic
Jonathan Hartley wrote:
On Mar 26, 6:26 pm, Luis M. González wrote:
On 26 mar, 11:49, kj wrote:
What's the word on using "classes as namespaces"? E.g.
class _cfg(object):
spam = 1
jambon = 3
huevos = 2
breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos)
C. B. wrote:
[snip]
It takes time to write the relative importations, that's ok, but I
think it could be more pleasant for the end-user to not have to write
a huge list of "from mymodule import xxx" if it is possible to take
advantage of automatic importations.
Cheers,
In that particular ca
John Nagle wrote:
Jonathan Hayward wrote:
I've posted "Usability, the Soul of Python: An Introduction to the
Python Programming Language Through the Eyes of Usability", at:
http://JonathansCorner.com/python/
No, it's just a rather verbose introduction to Python, in dark brown
type on a
Richard Lamboj wrote:
Hello,
are there any python bindings for libpst?
http://www.five-ten-sg.com/libpst/
https://alioth.debian.org/projects/libpst/
Kind Regards
Richi
http://www.lmgtfy.com/?q=libpst+python
3rd hit
Cheers,
JM
--
http://mail.python.org/mailman/listinfo/python-list
d here because getting a real reference from a weakref increases a
> reference counter. Maybe another option would be to store reference
> counters not in objects, but in a separate array to minimize number of
> memory pages they occupy...
It might be interesting to try with Jython or PyPy.
ng to have them drag you down. Fortunately the PyPy team is
making great progress in implementing a runtime that transparently
sheds
those dynamic features when running a program that doesn't take
advantage
of them.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
Roger Davis wrote:
Hi all,
[snip]
Roger Davis
# code follows
#!/usr/bin/python
import sys
import subprocess
def main():
psargs= ["/bin/ps", "-e"]
try:
ps= subprocess.Popen(psargs, stdout=subprocess.PIPE,
close_fds=True)
psout= ps.comm
Roger Davis wrote:
Completely off topic but I think the try clause could be rewritten that way:
...
Don't use bare except clause, you're masking syntax errors for instance,
which will be flagged as 'unexpected error in generation ...".
In a more general manner, if something unexpected happens it'
Tim Harig wrote:
On 2010-11-18, noydb wrote:
I have an executable that I want to run within python code. The exe
requires an input text file, the user to click a 'compute' button, and
then the exe calculates several output values, one of which I want to
capture into a variable. Can I use P
und.
When running as root, or when running on Windows, twistd does not add
the working directory to sys.path.
So with all that in mind, the solution should be pretty clear - just
set PYTHONPATH to include MyServerApp.
This variation of twistd behavior is pretty confusing, and I think a
future ver
completely accurate. It *is* possible to write a JIT
compiler
for a Python runtime which has fast path code for the common case, the
case
where the meaning of "+" doesn't change between every opcode. PyPy
has
produced some pretty good results with this approach.
For those who haven't seen it yet, http://speed.pypy.org/ has some
graphs
which reflect fairly well on PyPy's performance for benchmarks that
are not
entirely dissimilar to real world code.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
tazz_ben wrote:
Hi Folks -
I'm an experienced programmer, but this is my first app with python,
so I apologize for any stupidity on my part. So I've written/still
working on a command line tool written in Python. It talks to a web
service, so there really isn't anything in it that is dependen
Shel wrote:
Hello,
I am pretty new to all this. I have some coding experience, and am
currently most comfortable with Python. I also have database design
experience with MS Access, and have just created my first mySQL db.
So right now I have a mySQL db structure and some Python code. My end
go
Hy guys,
I'm struggling matching patterns ending with a comma ',' or an end of
line '$'.
import re
ex1 = 'sumthin,'
ex2 = 'sumthin'
m1 = re.match('(?P\S+),', ex1)
m2 = re.match('(?P\S+)$', ex2)
m3 = re.match('(?P\S+)[,$]', ex1)
m4 = re.match('(?P\S+)[,$]', ex2)
print m1, m2
print m3
print m4
MRAB wrote:
On 25/11/2010 14:40, Jean-Michel Pichavant wrote:
Hy guys,
I'm struggling matching patterns ending with a comma ',' or an end of
line '$'.
import re
ex1 = 'sumthin,'
ex2 = 'sumthin'
m1 = re.match('(?P\S+),', ex1)
m2 = re.matc
Gnarlodious wrote:
This works for me:
def sendList():
return ["item0", "item1"]
def query():
l=sendList()
return ["Formatting only {0} into a string".format(l[0]), l[1]]
query()
However, is there a way to bypass the
l=sendList()
and change one list item in-place? Possibly a lis
Gnarlodious wrote:
On Dec 1, 6:23 am, Jean-Michel Pichavant
wrote:
what about
def query():
return ["Formating only {0} into a string".format(sendList()[0])] +
sendList()[1:]
However this solution calls sendList() twice, which is too processor
intensive.
You got to
Tim Harig wrote:
On 2010-12-01, goldtech wrote:
Start
Main
Global Var
Subprogram1
Subprogram2
Subprogram3
End of Main
End
module_wide_var = value
def Subprogram1:
# code
def Subprogram2:
# code
def Subprogram3:
# code
def main:
Subpr
m b wrote:
> >
> > if __name__ == "__main__":
> > main()
What does this mean?
/Mikael
__name__ is an attribute of the module. Usually it is set to the module
name, except when the module is acutally executed as the entry point, in
that case __name__ is set to '__main__'.
foo.py:
print __n
Harishankar wrote:
As I said before, the way exceptions are caught seem to me to be the most
confusing bit. Non-atomic operations always worry me. What if my function
which is wrapped inside a try block has two different statements that
raised the same exception but for different reasons? With
Hello fellows,
I would need a unique internal identifier to an object. Can I use the
object python id ?
class Foo:
def getUniqueIdentifier():
return id(self)
This id needs to be unique and constant over the python process lifetime.
JM
--
http://mail.python.org/mailman/listinfo/pyt
Jean-Michel Pichavant wrote:
Hello fellows,
I would need a unique internal identifier to an object. Can I use the
object python id ?
class Foo:
def getUniqueIdentifier():
return id(self)
This id needs to be unique and constant over the python process lifetime.
JM
erratum
Jean-Michel Pichavant wrote:
Hello fellows,
I would need a unique internal identifier to an object. Can I use the
object python id ?
class Foo:
def getUniqueIdentifier():
return id(self)
This id needs to be unique and constant over the python process lifetime.
JM
sorry guys
"
Adam Tauno Williams wrote:
On Fri, 2010-12-03 at 14:44 +0100, Jean-Michel Pichavant wrote:
Hello fellows,
I would need a unique internal identifier to an object. Can I use the
object python id ?
class Foo:
def getUniqueIdentifier():
return id(self)
This id needs to be unique and
Xavier de Gaye wrote:
Pyclewn 1.5 has been released at http://pyclewn.sourceforge.net/
Pyclewn is a python program that allows the use of Vim as a front end
to gdb and pdb.
This release adds support for ``pdb``, the python debugger.
+ A python script may be run under the control of ``pdb``. F
Stef Mientki wrote:
On 06-12-2010 12:08, Ben Finney wrote:
Stef Mientki writes:
I would like to know if a class definition has a decorator,
I'm not sure what this question means.
Applying a decorator to a class definition produces a normal class.
Classes don't “have” decorators
RedBaron wrote:
Hi,
I am beginner to python and i am writing a program that does a lot of
things. One of the requirements is that the program shud generate a
log file. I came across python loggging module and found it very
useful. But I have a few problems
Suppose by giving option '-v' along with
Rustom Mody wrote:
If I have a medium to large python code base to browse/study, what are
the class browsers available?
vim + ctags is one of them.
JM
--
http://mail.python.org/mailman/listinfo/python-list
gst wrote:
greg.
nb: so this "hack" is only relevant during dev ; once the project
would be finished the "hack" could be removed (i.e : in class2 init I
would directly do : self.object1 = object1)
Expect some bugs then on the 'release' version.
I'm not sure I understood everything you menti
quoting eclipse page:
"Pydev [...] uses advanced type inference techniques to provide features
such code completion and code analysis"
I don't know exactly what's hidden behind this marketing stuff. Did you
try to document your method with a markup language supported by Eclipse
(if there is an
Astan Chee wrote:
Hi,
I've got a python script that calls a function many times with various
arguments and returns a result. What I'm trying to do is run this
function each on different processors and compile the result at the
end based on the function result. The script looks something like
this
On Dec 9, 8:15 pm, Paulo da Silva
wrote:
> Hi.
>
> Is there a python library/module to handle both the server and client
> sides of dns protocol?
>
> I have googled for it but I only found client side ones (at least from
> the superficial readings I did).
>
> Thanks.
Twisted Names is one such lib
Vinay Sajip wrote:
Some changes are being proposed to how logging works in default
configurations.
Briefly - when a logging event occurs which needs to be output to some
log, the behaviour of the logging package when no explicit logging
configuration is provided will change, most likely to log t
mark jason wrote:
On Dec 10, 11:55 am, Steven D'Aprano wrote:
# By the way, IOError is not the only exception you could see.
thanks for the help Steven. Is it OK to catch Exception instead of
IOError ?
In some operation which can cause many errors ,can I use the
following?
try:
Octavian Rasnita wrote:
It is true that Python doesn't use scope limitations for variables?
Octavian
Python does have scope. The problem is not the lack of scope, to
problem is the shadow declaration of some python construct in the
current scope.
print x # raise NameError
[x for x in ra
Dirk Nachbar wrote:
I want to take a copy of a list a
b=a
and then do things with b which don't affect a.
How can I do this?
Dirk
In [1]: a = [1,2,3]
In [2]: b = a[:]
In [3]: b[0] = 5
In [4]: a
Out[4]: [1, 2, 3]
In [5]: b
Out[5]: [5, 2, 3]
Alternatively, you can write
import copy
a
cassiope wrote:
Alternatively, you can write
import copy
a = [1,2,3]
b = a.copy()
JM
I'm not a pyguru, but... you didn't use copy quite right.
Try instead: b= copy.copy(a)
You're right, you're not a python guru so don't even try to contradict
me ever again.
...
:D of course I di
Vinay Sajip wrote:
On Dec 10, 10:17 am, Jean-Michel Pichavant
wrote:
Hi Jean-Michel,
I think Antoine answered your other points, so I'll address the last
one:
Last question, if no handler is found, why not simply drop the log
event, doing nothing ? It sounds pretty reasonable and
Octavian Rasnita wrote:
From: "Steven D'Aprano"
...
Can you please tell me how to write the following program in Python?
my $n = 1;
{
my $n = 2;
print "$n\n";
}
print "$n\n";
If this program if ran in Perl, it prints:
2
1
Lots of ways. Here's one:
n = 1
class Scope:
n
ernest wrote:
Hi,
I'd like to have a reference to an instance attribute as
default argument in a method. It doesn't work because
"self" is not defined at the time the method signature is
evaluated. For example:
class C(object):
def __init__(self):
self.foo = 5
def m(self, val=se
Paul Rubin wrote:
Steven D'Aprano writes:
I'm actually quite fond of the look of "while 1:", and sometimes use it,
not because it's faster, but just because I like it.
for v in itertools.repeat(True):
...
;-)
while '__For_ever___' not in ['nit-picking']:
:)
JM
--
http
Fellows,
I'd like to illutrate the fact that comparing strings using identity is,
most of the time, a bad idea. However I'm searching a short example of
code that yields 2 differents object for the same string content.
id('foo')
3082385472L
id('foo')
3082385472L
Anyone has that kind of code
Jean-Michel Pichavant wrote:
Fellows,
I'd like to illutrate the fact that comparing strings using identity
is, most of the time, a bad idea. However I'm searching a short
example of code that yields 2 differents object for the same string
content.
id('foo')
bruno.desthuilli...@gmail.com wrote:
On 16 déc, 12:55, Jean-Michel Pichavant
wrote:
id('foo')
3082385472L
id('foo')
3082385472L
Anyone has that kind of code ?
2 points:
1- an id is only valid for the lifetime of a given object - when the
object has been coll
Mel wrote:
Jean-Michel Pichavant wrote:
Fellows,
I'd like to illutrate the fact that comparing strings using identity is,
most of the time, a bad idea. However I'm searching a short example of
code that yields 2 differents object for the same string content.
id('foo')
John Gordon wrote:
(This is mostly a style question, and perhaps one that has already been
discussed elsewhere. If so, a pointer to that discussion will be
appreciated!)
When I started learning Python, I wrote a lot of methods that looked like
this:
def myMethod(self, arg1, arg2):
if s
Rob Richardson wrote:
-Original Message-
What about,
def myMethod():
for condition, exitCode in [
(cond1, 'error1'),
(cond2, 'very bad error'),
]:
if not condition:
break
else:
do_some_usefull_stuff() # executed only if the
cts, however, is an issue of larger scope than mere portability.
> ;)
>
The PyPy JIT supports x86_64. It's still being improved, but it does
provide real speedups in some cases already.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
e tooking too much time, which
> > > solution do you propose?
>
> > If possible, use multiple processes instead.
>
> > Diez- Nascondi testo citato
>
> > - Mostra testo citato -
>
> Multiple processes, ok, but then regarding processes' interruption
> there will be the same problems pointed out by using threads?
>
No. Processes can be terminated easily on all major platforms. See
`os.kill`.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 3, 4:17 pm, Adam Skutt wrote:
> On Jan 3, 4:06 pm, Jean-Paul Calderone
> wrote:
>
>
>
> > > Multiple processes, ok, but then regarding processes' interruption
> > > there will be the same problems pointed out by using threads?
>
> > No.
On Jan 3, 6:17 pm, Adam Skutt wrote:
> On Jan 3, 5:24 pm, Jean-Paul Calderone
> wrote:
>
> > Of course. The whole point here is not about threads vs processes.
> > It's about shared memory concurrency vs non-shared memory
> > concurrency. You can implement
On Jan 4, 12:31 pm, Fuzzyman wrote:
> On Jan 4, 3:31 pm, Roy Smith wrote:
>
>
>
> > In article
> > <2ebc11a5-1b45-4faa-97b9-c84f0db01...@k22g2000yqh.googlegroups.com>,
>
> > Fuzzyman wrote:
> > > It is unsafe to terminate an os level thread at an arbitrary point
> > > because it may be executin
Inyeol wrote:
For example: I'm writing simple class:
class Numbers:
def __init__(self, numbers):
self._numbers = numbers
def get_all(self):
for number in self._numbers:
yield number
If I want to add another method for yielding even num
David wrote:
Hi,
I'd like to have a function that takes arbitrary inputs and returns
them as a single string, with proper escapes for special characters I
can define. For example:
fun( ( + 1 2 ) )
=> "( + 1 2)"
or
fun( (define (myhello str) (begin (print (string-append "Hello "
str)) (newli
kost BebiX wrote:
Hi everyone!
I just saw a bug (?) in bson.dbref:DBRef.__getattr__
Here's they're code:
def __getattr__(self, key):
return self.__kwargs[key]
And when you do copy.deepcopy on that object it will raise you KeyError. So
here's a small piece of code that reproduces th
kost BebiX wrote:
You're absolutely right! Now try to do except Keyerror: raise AttributeError
and it will also fail. But why?
07.01.2011, 15:45, "Jean-Michel Pichavant" :
kost BebiX wrote:
Hi everyone!
I just saw a bug (?) in bson.dbref:DBRef.__getattr__
Here
kost BebiX wrote:
Sorry for top posting, didn't know about that) I'm quote new to posting to
mailing lists.
Well, actually the code you showed doesn't work)
class A(object):
.. def __init__(self):
.. self.d = {}
.. def __getattr__(self, key):
.. try:
..
1501 - 1600 of 1973 matches
Mail list logo