Hello,
i have e little performance problem with my code...
i have to compare many lists of very much floats. at moment i have
nested for-loops
for a in range( len(lists) ):
for b in range( a+1 , len(lists) ):
for valuea in lists[a]:
equal=False
for valueb in l
Hello,
i have e little performance problem with my code...
i have to compare many lists of very much floats. at moment i have
nested for-loops
for a in range( len(lists) ):
for b in range( a+1 , len(lists) ):
for valuea in lists[a]:
equal=False
for valueb in lists
Christian Doll wrote:
> i have e little performance problem with my code...
>
> i have to compare many lists of very much floats. at moment i have
> nested for-loops
>
> for a in range( len(lists) ):
> for b in range( a+1 , len(lists) ):
> for valuea in lists[a]:
> equal=
Hello guys,
I would like to translate all strings in my application for several
languages (eng, es, de, etc) and user should be able to switch app
from one language to another. I am still newbie with python so is
there any "step-by-step" tutorial how to to this? thanks for help
--
http://mail.pyt
Hello guys,
I would like to translate all strings in my application for several
languages (eng, es, de, etc) and user should be able to switch app
from one language to another. I am still newbie with python so is
there any "step-by-step" tutorial how to to this? thanks for help
--
http://mail.pyt
On Thu, Jul 28, 2011 at 2:11 AM, Peter Irbizon wrote:
> Hello guys,
>
> I would like to translate all strings in my application for several
> languages (eng, es, de, etc) and user should be able to switch app
> from one language to another. I am still newbie with python so is
> there any "step-by-
On Thu, Jul 28, 2011 at 8:34 AM, rantingrick wrote:
>> --
>> Encodings (PEP 263)
>>
>> Code in the core Python distribution should always use the
>> ASCII or Latin-1 encoding (a.k.a. ISO-8859-1). For Python
>> 3.0 and beyond, UTF-8 is prefer
Hi
pickling
Just crossposting this from stackoverflow:
http://stackoverflow.com/questions/6857006/python-monotonically-increasing-memory-usage-leak
Any hints?
Pedro.
--
Pedro Larroy Tovar | http://pedro.larroy.com/
--
http://mail.python.org/mailman/listinfo/python-list
When using re patterns of the form 'A|B|C|...' the docs seem to
suggest that once any of A,B,C.. match, it is captured and no further
patterns are tried. But I am seeing,
st=' Id NameProv Type CopyOf BsId
Rd -Detailed_State-Adm Snp Usr VSize'
p='T
Hello,
thank you for reply.
I tried this:
# -*- coding: utf-8 -*-
import gettext
gettext.bindtextdomain('multilanguage',
'E:\folder')
gettext.textdomain('multilanguage')
_ = gettext.gettext
# ...
lang1 = gettext.translation('multilanguage', languages=['sk'])
lang1.install()
print _('This is a tran
On 2011.07.28 05:12 AM, Peter Irbizon wrote:
> P.S. sorry for double posting but when I post my message on googlegroups I
> can't see it in googlegroups (don't know why)
Last time I looked at this newsgroup (which was not that long ago) on
Google Groups, it was 2 days behind.
--
CPython 3.2.1 | W
Is there anyway in python to get a notification when a process exits?
To be completely clear, I am looking for a notification solution,
similar to pyinotify, not a polling one (I know I can poll a process
using os.kill(pid, 0)).
BTW, pyinotify will not work on /proc/pid as a solution. I have
alrea
AlienBaby wrote:
> When using re patterns of the form 'A|B|C|...' the docs seem to
> suggest that once any of A,B,C.. match, it is captured and no further
> patterns are tried. But I am seeing,
>
> st=' Id NameProv Type CopyOf BsId
> Rd -Detailed_State-Adm
Hello,
__all__ = 'api db input output tcl'.split()
or
__all__ = """
api
db
input
output
tcl
""".split()
for lazy boy ;o). It is readable as well.
What do you think?
Cheers
Karim
--
http://mail.python.or
Karim writes:
> Hello,
>
> __all__ = 'api db input output tcl'.split()
>
> or
>
> __all__ = """
>api
>db
>input
>output
>tcl
>""".split()
Maybe this:
__all__ = [x.__name__ for x in [
api,
On 7/27/2011 9:46 PM, Dennis Lee Bieber wrote:
On Wed, 27 Jul 2011 17:28:38 -0700, "W. eWatson"
declaimed the following in
gmane.comp.python.general:
For junk.py, I tried Open With->Choose default program. I selected
idle.pyw. When I tried the new default for getting to IDLE, it
complained i
On 2011-07-28 13:56, W. eWatson wrote:
On 7/27/2011 9:46 PM, Dennis Lee Bieber wrote:
{and that was captured by a in the command window, "select
all", another to capture, then move to the newreader and
to paste}
I'm quite willing to do this in the command window, but I know of no
way to co
Am 28.07.2011 13:32 schrieb Karim:
Hello,
__all__ = 'api db input output tcl'.split()
or
__all__ = """
api
db
input
output
tcl
""".split()
for lazy boy ;o). It is readable as well.
What do you think?
Why not? But you could even do
class AllList(list):
"""list which can be called in or
I used gettext in xmm2tray. You can have a look at the code as an example:
http://code.jollybox.de/hg/xmms2tray/file/04443c59a7a1/src/xmms2tray/__init__.py
On 2011-07-28 12:12, Peter Irbizon wrote:
I tried this:
# -*- coding: utf-8 -*-
import gettext
gettext.bindtextdomain('multilanguage', 'E:\f
On 07/28/2011 02:29 PM, Thomas Rachel wrote:
__all__ = AllList()
Hello Thomas,
Very beautiful and elegant code. Having both at the same time an
instance and a method...
With this 'small' topic, you taught me something today on property
application!
Cheers
Karim
--
http://mail.python.org/ma
On Wed, Jul 27, 2011 at 5:26 PM, W. eWatson wrote:
> .py=Python.File
> .pyw=Python.NoConFile
> Python.File="C:\Python25\python.exe" "%1" %*
> Python.File="C:\Python25\python.exe" "%1" %*
> Python.NoConFile="C:\Python25\pythonw.exe" "%1" %*
That all looks good.
> I cannot copy from the cmd window
HI Thomas,
I've not really got the hang of decorators yet, so I was wondering why one
might use your approach rather than just using Karim's original method?
I only really use python for smallish, utility programs, so I suppose I
haven't come across an issue complex enough to see a clear advantag
Hello,
I have
variable OUHH and
print _('This is %(OUHH)s a translatable string.' % locals())
how can I translate this ?
--
http://mail.python.org/mailman/listinfo/python-list
On 28/07/11 15:33, miamia wrote:
> Hello,
> I have
> variable OUHH and
> print _('This is %(OUHH)s a translatable string.' % locals())
>
> how can I translate this ?
Get the translation first, insert values second.
_('This string contains a variable: {0}. Amazing').format(OUHH)
Depending on wha
Hello,
is there a way to use epydoc to document a Python function that has been
decorated?
@decorator
def func1():
""" My function func1 """
print "In func1"
The resulting output of epydoc is that func1 gets listed as a variable
with no description.
I am using Epydoc v3.0.1.
Thanks
On 7/28/2011 6:19 AM, Jerry Hill wrote:
On Wed, Jul 27, 2011 at 5:26 PM, W. eWatson wrote:
.py=Python.File
.pyw=Python.NoConFile
Python.File="C:\Python25\python.exe" "%1" %*
Python.File="C:\Python25\python.exe" "%1" %*
Python.NoConFile="C:\Python25\pythonw.exe" "%1" %*
That all looks good.
On 7/28/2011 8:10 AM, W. eWatson wrote:
On 7/28/2011 6:19 AM, Jerry Hill wrote:
On Wed, Jul 27, 2011 at 5:26 PM, W. eWatson
wrote:
.py=Python.File
.pyw=Python.NoConFile
Python.File="C:\Python25\python.exe" "%1" %*
Python.File="C:\Python25\python.exe" "%1" %*
Python.NoConFile="C:\Python25\python
Consider:
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
--> for ins in ({0:'0'}, (1,), set([2, 3]), [4, 5], 6, 'seven',
... 8.0, True, None):
... print(type(ins))
... type(ins)()
...
On 07/28/2011 11:39 AM, Ethan Furman wrote:
Traceback (most recent call last):
File "", line 3, in
TypeError: cannot create 'NoneType' instances
Why is NoneType unable to produce a None instance? I realise that None
is a singleton, but so are True and False, and bool is able to handle
returnin
On Thu, Jul 28, 2011 at 11:13 AM, Danny Wong (dannwong)
wrote:
> Hi Python experts,
> I'm trying to use a dict structure to store and update information
> from X number of threads. How do I share this dict structure between threads?
> I heard of using a queue, but I'm not familiar with ho
Hello You have you feet on earth Web Dreamer!
Very clever!
Beautiful hack!
Many Thanks
Karim
On 07/28/2011 05:48 PM, Web Dreamer wrote:
Karim a écrit ce mercredi 27 juillet 2011 21:30
dans :
Hello All,
I would like to parse this TCL command line with shlex:
'-option1 [get_rule A1 B2]
On Thu, 28 Jul 2011 17:48:34 +0200, Web Dreamer wrote:
>> I would like to parse this TCL command line with shlex:
>>
>> '-option1 [get_rule A1 B2] -option2 $VAR -option3 TAG'
s = s.replace('[','"[')
s = s.replace(']',']"')
Note that this approach won't work if you have nested brackets
I replied to 'm' but I really wanted to reply to the whole group -
Patty
Here it is:
- Original Message -
From: "Patty"
To:
Sent: Thursday, July 28, 2011 8:10 AM
Subject: Re: Programming Python for Absolute Beginners
- Original Message -
From: "harrismh777"
Newsgroup
On Thu, 28 Jul 2011 11:52:25 +0200, Pedro Larroy wrote:
> pickling
>
> Just crossposting this from stackoverflow:
>
> http://stackoverflow.com/questions/6857006/
>
> Any hints?
AFAIK, it's because the Pickler object keeps a reference to each object so
that pointer-sharing works; if you write t
On Thu, Jul 28, 2011 at 9:39 AM, Ethan Furman wrote:
> Why is NoneType unable to produce a None instance? I realise that None is a
> singleton, but so are True and False, and bool is able to handle returning
> them:
The bool constructor works (actually just returns one of the existing
singletons
Just a little modification:
>>> tuple([(option, value) for option,value in
zip(optionlist[0::2],optionlist[1::2])]) ==
tuple(zip(optionlist[0::2],optionlist[1::2]))
True
Indeed:
tuple(zip(optionlist[0::2],optionlist[1::2]))
shorter than:
tuple([(option, value) for option,value in
zip(opt
On Thu, Jul 28, 2011 at 7:22 AM, mark ferguson wrote:
> I've not really got the hang of decorators yet, so I was wondering why one
> might use your approach rather than just using Karim's original method?
The advantage of Thomas's decorator here is that it lets you place the
denotation of whether
You'd probably better explain in English which things truly need to be
compared with what. Right now, your first version is, I believe, an O(n^4)
algorithm, which is extremely expensive, while your second (set-based)
version appears to be O(n^3), which is quite a bit better, but still not
stellar.
[python 2.7] I have a (linux) pathname that I'd like to split
completely into a list of components, e.g.:
'/home/gyoung/hacks/pathhack/foo.py' --> ['home', 'gyoung',
'hacks', 'pathhack', 'foo.py']
os.path.split gives me a tuple of dirname,basename, but there's no
os.path.split_all function.
Hi,
[python 2.7] I have a (linux) pathname that I'd like to split
completely into a list of components, e.g.:
'/home/gyoung/hacks/pathhack/foo.py' --> ['home', 'gyoung',
'hacks', 'pathhack', 'foo.py']
Not sure what your exact requirements are, but the following seems to work:
pathname
On 2011-07-28, gry wrote:
> [python 2.7] I have a (linux) pathname that I'd like to split
> completely into a list of components, e.g.:
>'/home/gyoung/hacks/pathhack/foo.py' --> ['home', 'gyoung',
> 'hacks', 'pathhack', 'foo.py']
>
> os.path.split gives me a tuple of dirname,basename, but th
On Thu, Jul 28, 2011 at 2:18 PM, gry wrote:
> [python 2.7] I have a (linux) pathname that I'd like to split
> completely into a list of components, e.g.:
> '/home/gyoung/hacks/pathhack/foo.py' --> ['home', 'gyoung',
> 'hacks', 'pathhack', 'foo.py']
>
> os.path.split gives me a tuple of dirname
On 7/28/2011 4:18 PM, gry wrote:
[python 2.7] I have a (linux) pathname that I'd like to split
completely into a list of components, e.g.:
'/home/gyoung/hacks/pathhack/foo.py' --> ['home', 'gyoung',
'hacks', 'pathhack', 'foo.py']
os.path.split gives me a tuple of dirname,basename, but the
Ian Kelly wrote:
On Thu, Jul 28, 2011 at 9:39 AM, Ethan Furman wrote:
Why is NoneType unable to produce a None instance? I realise that None is a
singleton, but so are True and False, and bool is able to handle returning
them:
The bool constructor works (actually just returns one of the exis
On Thu, Jul 28, 2011 at 2:44 PM, Ian Kelly wrote:
> path = '/home/gyoung/hacks/pathhack/foo.py'
> parts = [part for path, part in iter(lambda: os.path.split(path), ('/', ''))]
> parts.reverse()
> print parts
>
> But that's horrendously ugly. Just write a generator with a while
> loop or something
Neil Cerutti wrote:
If an elegant solution doesn't occur to me right away, then I
first compose the most obvious solution I can think of. Finally,
I refactor it until elegance is either achieved or imagined.
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Jul 28, 2011 at 2:47 PM, Ian Kelly wrote:
> On Thu, Jul 28, 2011 at 2:44 PM, Ian Kelly wrote:
>> path = '/home/gyoung/hacks/pathhack/foo.py'
>> parts = [part for path, part in iter(lambda: os.path.split(path), ('/', ''))]
>> parts.reverse()
>> print parts
>>
>> But that's horrendously ugl
On 28.07.2011 22:44, Ian Kelly wrote:
On Thu, Jul 28, 2011 at 2:18 PM, gry wrote:
[python 2.7] I have a (linux) pathname that I'd like to split
completely into a list of components, e.g.:
'/home/gyoung/hacks/pathhack/foo.py' -->['home', 'gyoung',
'hacks', 'pathhack', 'foo.py']
os.path.
I start many threads in order to make the work done, when the
concurrent number is set to 300, all thing just works fine, but when
the number is set to 350 or higher, error just comes out? what's wrong
? the error info is just as follows: failed to start .
I am confused, does this have something
On 7/28/2011 1:18 PM gry said...
[python 2.7] I have a (linux) pathname that I'd like to split
completely into a list of components, e.g.:
'/home/gyoung/hacks/pathhack/foo.py' --> ['home', 'gyoung',
'hacks', 'pathhack', 'foo.py']
os.path.split gives me a tuple of dirname,basename, but the
On Fri, Jul 29, 2011 at 7:03 AM, Ethan Furman wrote:
> I'll use a lambda to get around it, but that's not very elegant. Why
> shouldn't NoneType be able to return the singleton None?
Why a lambda?
def ThisFunctionWillReturnNone():
pass
Although, since the returning of None is crucial to it
On Thu, Jul 28, 2011 at 3:15 PM, Emile van Sebille wrote:
> On 7/28/2011 1:18 PM gry said...
>>
>> [python 2.7] I have a (linux) pathname that I'd like to split
>> completely into a list of components, e.g.:
>> '/home/gyoung/hacks/pathhack/foo.py' --> ['home', 'gyoung',
>> 'hacks', 'pathhack
On Jul 26, 9:53 pm, Terry Reedy wrote:
> On 7/26/2011 8:01 PM, rantingrick wrote:
>
> > Most new user think that printing an object to stdout is all they'll
> > ever need. However when you call print -- or sys.stdout.write(object)
> > -- you are only seeing a "friendly" version of the object.
>
>
Ethan Furman writes:
> Why is NoneType unable to produce a None instance? I realise that None
> is a singleton
That answers your question. Because None is a singleton, the job of its
type is to make sure there are no other instances.
> but so are True and False, and bool is able to handle retur
Chris Angelico wrote:
On Fri, Jul 29, 2011 at 7:03 AM, Ethan Furman wrote:
I'll use a lambda to get around it, but that's not very elegant. Why
shouldn't NoneType be able to return the singleton None?
Why a lambda?
def ThisFunctionWillReturnNone():
pass
Although, since the returning of
Ben Finney wrote:
Ethan Furman writes:
Why is NoneType unable to produce a None instance? I realise that None
is a singleton
That answers your question. Because None is a singleton, the job of its
type is to make sure there are no other instances.
Which it can do quite easily by returning
On 28-7-2011 23:07, smith jack wrote:
> I start many threads in order to make the work done, when the
> concurrent number is set to 300, all thing just works fine, but when
> the number is set to 350 or higher, error just comes out? what's wrong
> ? the error info is just as follows: failed to st
I believe the current Python style guide is inconsistent. The author
again allowed his emotion to get in the way of logic. I will be
posting blocks of text from the PEP8 and commenting below them.
> --
> One of Guido's key insights is that c
Ethan Furman writes:
> Ben Finney wrote:
> > Ethan Furman writes:
> >> This feels like a violation of 'Special cases aren't special enough
> >> to break the rules.'
> >
> > In the case of ‘bool’, the rule was broken before being introduced.
>
> I think we disagree on what the rule is. I see it
You could try Jython.
Other than that, you probably want a threadpool, or perhaps to try
multiprocessing - but that much forking could be a problem as well.
On Thu, Jul 28, 2011 at 2:07 PM, smith jack wrote:
> I start many threads in order to make the work done, when the
> concurrent number is
rantingrick wrote:
I believe the current Python style guide is inconsistent. The author
again allowed his emotion to get in the way of logic.
Well, does not PEP8 state, "A Foolish Consistency is the Hobgoblin
of Little Minds" ?
Your parody is witty, and not without serious commentary;
Am 28.07.2011 23:07, schrieb smith jack:
> I start many threads in order to make the work done, when the
> concurrent number is set to 300, all thing just works fine, but when
> the number is set to 350 or higher, error just comes out? what's wrong
> ? the error info is just as follows: failed to
Ethan Furman wrote:
> Why is NoneType unable to produce a None instance? I realise that None
> is a singleton, but so are True and False, and bool is able to handle
> returning them:
I've asked this question myself. As I recall the answer, it's just a matter
of personal preference. Some people c
hello,
I am using gettext fo localization
local_path=os.path.join(module_path(), lang_folder)
gettext.bindtextdomain(lang_name, local_path)
gettext.textdomain(lang_name)
# Get the language to use
lang = gettext.translation(lang_name, local_path, languages=['s
Ian Kelly wrote:
> Why would you ever need to instantiate NoneType?
Well, you probably wouldn't deliberately, but if you have code like this:
types = [type(x) for x in list_of_objects]
# later on...
for t in types:
instance = t()
do_something_with(instance)
it would be nice if it did
Chris Angelico wrote:
> On Fri, Jul 29, 2011 at 7:03 AM, Ethan Furman wrote:
>> I'll use a lambda to get around it, but that's not very elegant. Why
>> shouldn't NoneType be able to return the singleton None?
>
> Why a lambda?
>
> def ThisFunctionWillReturnNone():
> pass
This is a good us
On 7/28/2011 5:03 PM, Ethan Furman wrote:
I'm glad you asked! I'm using dictionaries to describe fields and
what their return values should be. There happen to be two special
cases: empty and Null. So a portion of the dictionary looks like:
fielddef = { 'empty':some_func, 'null':some_func }
De
On Thu, Jul 28, 2011 at 6:20 PM, Peter Irbizon wrote:
> hello,
> I am using gettext fo localization
> Now I would like to switch all texts in my app when I click on item in menu.
> Unfortunatelly this not switch texts immediately. How can I do this?
Which GUI toolkit are you using?
Cheers,
Chri
I've given this problem over to the Python Tutor mail-list. I can
capture screens more easily than manipulate in cmd.exe. It may be a
preference problem on who owns what. SYSTEM seems to be the owner, and
not me.
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Rachel wrote:
Why not? But you could even do
class AllList(list):
"""list which can be called in order to be used as a __all__-adding
decorator"""
def __call__(self, obj):
"""for decorators"""
self.append(obj.__name__)
return obj
__all__ = AllList()
@__
Am 28.07.2011 20:01 schrieb Ian Kelly:
The advantage of Thomas's decorator here is that it lets you place the
denotation of whether a function is exported alongside its definition,
whereas simply declaring the __all__ list forces you to separate them.
It also avoids the problem of possibly mis
71 matches
Mail list logo