On 20/05/2013 18:13, Chris Angelico wrote:
On Mon, May 20, 2013 at 11:26 PM, Frank Millman wrote:
0 - for the first entry in the list, the word 'check' (a placeholder - it is
discarded at evaluation time), for any subsequent entries the word 'and' or
'or'.
1 - left bracket - either '(' or ''.
On 20/05/2013 18:12, Steven D'Aprano wrote:
On Mon, 20 May 2013 15:26:02 +0200, Frank Millman wrote:
Can anyone see anything wrong with the following approach. I have not
definitely decided to do it this way, but I have been experimenting and
it seems to work.
[...]
It seems safe to me too,
On 21/05/2013 04:39, matt.newvi...@gmail.com wrote:
You might find the asteval module (https://pypi.python.org/pypi/asteval) useful. It
provides a relatively safe "eval", for example:
>>> import asteval
>>> a = asteval.Interpreter()
>>> a.eval('x = "abc"')
>>> a.eval('x i
In article ,
Carlos Nepomuceno wrote:
> Is there a way to format integers with thousands separator (digit grouping)
> like the format specifier of str.format()?>
> I'm currently using the following:>
> >>> sys.stdout.write('Number = %s\n' % '{:,.0f}'.format(x))
> Number = 12,345>
> 'x' is uns
Is there a way to format integers with thousands separator (digit grouping)
like the format specifier of str.format()?
I'm currently using the following:
>>> sys.stdout.write('Number = %s\n' % '{:,.0f}'.format(x))
Number = 12,345
'x' is unsigned integer so it's like using a sledgehammer to crac
On Tue, 21 May 2013 05:53:46 +0300, Carlos Nepomuceno wrote:
> BTW, why I didn't find the source code to the sys module in the 'Lib'
> directory?
Because sys is a built-in module. It is embedded in the Python
interpreter.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
Thanks a lot. I got it.
On Tue, May 21, 2013 at 6:42 AM, Cameron Simpson wrote:
> On 20May2013 15:05, Avnesh Shakya wrote:
> | Thanks a lot.
>
> No worries, but ...
>
> AGAIN:
> - please DO NOT top post. Post below, trimming the quoted material.
> - please POST TO THE LIST, not just to me.
> On Tue, May 21, 2013 at 11:44 AM, 8 Dihedral
> wrote:
>> OK, if the python interpreter has a global hiden print out
>> buffer of ,say, 2to 16 K bytes, and all string print functions
>> just construct the output string from the format to this string
>> in an efficient low level way, then the
On 20May2013 15:05, Avnesh Shakya wrote:
| Thanks a lot.
No worries, but ...
AGAIN:
- please DO NOT top post. Post below, trimming the quoted material.
- please POST TO THE LIST, not just to me. This is a public discussion.
Now...
| I did something.
| I have created test.sh file in which i
sys.stdout.write() does not suffer from the newlines mess up when printing from
many threads, like print statement does.
The only usage difference, AFAIK, is to add '\n' at the end of the string.
It's faster and thread safe (really?) by default.
BTW, why I didn't find the source code to the sys
On Monday, May 20, 2013 2:05:48 AM UTC-5, Frank Millman wrote:
> Hi all
>
>
>
> I am trying to emulate a SQL check constraint in Python. Quoting from
>
> the PostgreSQL docs, "A check constraint is the most generic constraint
>
> type. It allows you to specify that the value in a certain column mus
On Tue, May 21, 2013 at 11:44 AM, 8 Dihedral
wrote:
> OK, if the python interpreter has a global hiden print out
> buffer of ,say, 2to 16 K bytes, and all string print functions
> just construct the output string from the format to this string
> in an efficient low level way, then the next qu
Chris Angelico於 2013年5月20日星期一UTC+8下午5時09分13秒寫道:
> On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson wrote:
>
> > _lock = Lock()
>
> >
>
> > def lprint(*a, **kw):
>
> > global _lock
>
> > with _lock:
>
> > print(*a, **kw)
>
> >
>
> > and use lprint() everywhere?
>
>
>
>
On 2013-05-20, Terry Jan Reedy wrote:
> On 5/20/2013 1:04 AM, Vito De Tullio wrote:
>> Terry Jan Reedy wrote:
>>
Do you think tkinter is going to be the standard python built-in gui
solution as long as python exists?
>>>
>>> AT the moment, there is nothing really comparable that is a rea
On 5/20/2013 3:36 PM, Thomas Murphy wrote:
talking about "patches" in the stdlib? Is there a separate library of
patches?
http://bugs.python.org
http://docs.python.org/devguide/
--
http://mail.python.org/mailman/listinfo/python-list
Hi Demian,
Can I ask what you mean by working through the stdlib? As in writing
code pieces utilizing each module from the stdlib? Also, you're
talking about "patches" in the stdlib? Is there a separate library of
patches? Forgive me if I'm google-failing hard over here.
--
http://mail.python.org
TBH, I think that the first thing that I did that made me feel that I
could hold my own was when I had my first (and only thus far) patch
accepted into the stdlib. To me, there's a /big/ difference between
throwing together a package that a few people may find useful and
putting a patch together th
I didn't know that.
On 20 May 2013 12:10, "Dave Angel" wrote:
> Are you making function calls, using system libraries, or creating or
deleting any objects? All of these use the GIL because they use common
data structures shared among all threads. At the lowest level, creating an
object requires
We use github and we work on many different branches at the same time.
The problem is that we have >5 repos now, and for each repo we might
have the same branches on all of them.
Now we use pip and install requirements such as:
git+ssh://g...@github.com/repo.git@dev
Now the problem is that the r
Oops, I thought we were posting to comp.dsp. Nevertheless, I think
numpy.fft does mixed-radix (can't check it now)
Am 20.05.13 19:50, schrieb Christian Gollwitzer:
Am 20.05.13 19:23, schrieb jmfauth:
Non sense.
Dito.
The discrete fft algorithm is valid only if the number of data
points you
Am 20.05.13 19:23, schrieb jmfauth:
Non sense.
Dito.
The discrete fft algorithm is valid only if the number of data
points you transform does correspond to a power of 2 (2**n).
Where did you get this? The DFT is defined for any integer point number
the same way.
Just if you want to get i
Non sense.
The discrete fft algorithm is valid only if the number of data
points you transform does correspond to a power of 2 (2**n).
Keywords to the problem: apodization, zero filling, convolution
product, ...
eg. http://en.wikipedia.org/wiki/Convolution
jmf
--
http://mail.python.org/mailma
On Tue, May 21, 2013 at 2:12 AM, Steven D'Aprano
wrote:
> Personally, I would strongly suggest writing your own mini-
> evaluator that walks the list and evaluates it by hand. It isn't as
> convenient as just calling eval, but *definitely* safer.
Probably faster, too, for what it's worth - eval i
On Mon, May 20, 2013 at 11:26 PM, Frank Millman wrote:
> 0 - for the first entry in the list, the word 'check' (a placeholder - it is
> discarded at evaluation time), for any subsequent entries the word 'and' or
> 'or'.
>
> 1 - left bracket - either '(' or ''.
>
> 5 - right bracket - either ')' or
On Mon, 20 May 2013 15:26:02 +0200, Frank Millman wrote:
> Can anyone see anything wrong with the following approach. I have not
> definitely decided to do it this way, but I have been experimenting and
> it seems to work.
>
> I store the boolean test as a json'd list of 6-part tuples. Each eleme
=On Mon, May 20, 2013 at 8:46 PM, Ned Batchelder wrote:
> On 5/20/2013 6:09 AM, Chris Angelico wrote:
>>
>> Referencing a function's own name in a default has to have one of
>> these interpretations:
>>
>> 1) It's a self-reference, which can be used to guarantee recursion
>> even if the name is re
On 20/05/2013 10:07, Frank Millman wrote:
On 20/05/2013 09:55, Chris Angelico wrote:
Is it a requirement that they be able to key in a constraint as a
single string? We have a similar situation in one of the systems at
work, so we divided the input into three(ish) parts: pick a field,
pick an op
On 05/20/2013 03:55 AM, Fábio Santos wrote:
My use case was a tight loop processing an image pixel by pixel, or
crunching a CSV file. If it only uses local variables (and probably hold a
lock before releasing the GIL) it should be safe, no?
Are you making function calls, using system libraries
On 5/20/2013 6:09 AM, Chris Angelico wrote:
Referencing a function's own name in a default has to have one of
these interpretations:
1) It's a self-reference, which can be used to guarantee recursion
even if the name is rebound
2) It references whatever previously held that name before this def
Oh well! Just got a flashback from the old times at the 8-bit assembly line.
Dirty deeds done dirt cheap! lol
> Date: Sun, 19 May 2013 16:44:55 +0100
> From: pyt...@mrabarnett.plus.com
> To: python-list@python.org
> Subject: Re: How to write fast into a fi
On 5/20/13 1:04 AM, Vito De Tullio wrote:
FLTK? (http://www.fltk.org/index.php)
FLTK is even uglier than non-themed Tkinter: non-native on every
platform. Tkinter wraps native widgets on MacOS and WIndows, but FLTK
draws its own widgets everywhere.
--
Kevin Walzer
Code by Kevin/Mobile Code
On Mon, May 20, 2013 at 7:54 PM, Cameron Simpson wrote:
> On 20May2013 19:09, Chris Angelico wrote:
> | On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson wrote:
> | > _lock = Lock()
> | >
> | > def lprint(*a, **kw):
> | > global _lock
> | > with _lock:
> | > print(*a, **kw)
> |
> Date: Mon, 20 May 2013 18:35:20 +1000
> From: c...@zip.com.au
> To: carlosnepomuc...@outlook.com
> CC: python-list@python.org
> Subject: Re: Please help with Threading
>
> On 20May2013 10:53, Carlos Nepomuceno wrote:
> | I just got my hands dirty trying t
On 20May2013 19:09, Chris Angelico wrote:
| On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson wrote:
| > _lock = Lock()
| >
| > def lprint(*a, **kw):
| > global _lock
| > with _lock:
| > print(*a, **kw)
| >
| > and use lprint() everywhere?
|
| Fun little hack:
|
| def print(*ar
It is pretty cool although it looks like a recursive function at first ;)
On 20 May 2013 10:13, "Chris Angelico" wrote:
> On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson wrote:
> > _lock = Lock()
> >
> > def lprint(*a, **kw):
> > global _lock
> > with _lock:
> > print(*a, **kw
On 2013-05-20 08:00, Terry Jan Reedy wrote:
On 5/20/2013 1:04 AM, Vito De Tullio wrote:
Terry Jan Reedy wrote:
Do you think tkinter is going to be the standard python built-in gui
solution as long as python exists?
AT the moment, there is nothing really comparable that is a realistic
candida
On Fri, 2013-05-17, Olive wrote:
> One feature that seems to be missing in the re module (or any tools
> that I know for searching text) is "diacretical incensitive search". I
> would like to have a match for something like this:
> re.match("franc", "français")
...
> The algorithm to write such
On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson wrote:
> _lock = Lock()
>
> def lprint(*a, **kw):
> global _lock
> with _lock:
> print(*a, **kw)
>
> and use lprint() everywhere?
Fun little hack:
def print(*args,print=print,lock=Lock(),**kwargs):
with lock:
print(*args,**
On 20 May 2013 09:19, "Frank Millman" wrote:
> Quoting from the manual -
>
> "Safely evaluate an expression node or a string containing a Python
expression. The string or node provided may only consist of the following
Python literal structures: strings, bytes, numbers, tuples, lists, dicts,
sets,
On 20May2013 10:53, Carlos Nepomuceno wrote:
| I just got my hands dirty trying to synchronize Python prints from many
threads.
| Sometimes they mess up when printing the newlines.
| I tried several approaches using threading.Lock and Condition.
| None of them worked perfectly and all of them ma
On Mon, 20 May 2013 10:55:35 +0300, Carlos Nepomuceno wrote:
> I understand your motivation but I don't know what protection
> ast.literal_eval() is offering that eval() doesn't.
eval will evaluate any legal Python expression:
py> eval("__import__('os').system('echo Mwahaha! Now you are pwned!'
On 20/05/2013 09:55, Carlos Nepomuceno wrote:
Why don't you use eval()?
Because users can create their own columns, with their own constraints.
Therefore the string is user-modifiable, so it cannot be trusted.
I understand your motivation but I don'
On Mon, May 20, 2013 at 5:55 PM, Carlos Nepomuceno
wrote:
> I understand your motivation but I don't know what protection
> ast.literal_eval() is offering that eval() doesn't.
eval will *execute code*, while literal_eval will not. That's the
protection. With ast.literal_eval, all that can happen
On 20/05/2013 09:55, Chris Angelico wrote:
On Mon, May 20, 2013 at 5:50 PM, Frank Millman wrote:
On 20/05/2013 09:34, Carlos Nepomuceno wrote:
Why don't you use eval()?
Because users can create their own columns, with their own constraints.
Therefore the string is user-modifiable, so it can
> To: python-list@python.org
> From: fr...@chagford.com
> Subject: Re: Question about ast.literal_eval
> Date: Mon, 20 May 2013 09:50:02 +0200
>
> [Corrected top-posting]
>
>>> To: python-list@python.org
>>> From: fr...@chagford.com
>>> Subject: Question abo
My use case was a tight loop processing an image pixel by pixel, or
crunching a CSV file. If it only uses local variables (and probably hold a
lock before releasing the GIL) it should be safe, no?
My idea is that it's a little bad to have to write C or use multiprocessing
just to do simultaneous c
On Mon, May 20, 2013 at 5:50 PM, Frank Millman wrote:
> On 20/05/2013 09:34, Carlos Nepomuceno wrote:
>> Why don't you use eval()?
>>
>
> Because users can create their own columns, with their own constraints.
> Therefore the string is user-modifiable, so it cannot be trusted.
Plenty of reason ri
> Date: Mon, 20 May 2013 17:45:14 +1000
> From: c...@zip.com.au
> To: fabiosantos...@gmail.com
> Subject: Re: Please help with Threading
> CC: python-list@python.org; wlfr...@ix.netcom.com
>
> On 20May2013 07:25, Fábio Santos wrote:
> | On 18 May 2013 20:33
[Corrected top-posting]
>> To: python-list@python.org
From: fr...@chagford.com
Subject: Question about ast.literal_eval
Date: Mon, 20 May 2013 09:05:48 +0200
Hi all
I am trying to emulate a SQL check constraint in Python. Quoting from
the PostgreSQL docs, "A check constraint is the most generi
> Date: Sun, 19 May 2013 13:10:36 +1000
> From: c...@zip.com.au
> To: carlosnepomuc...@outlook.com
> CC: python-list@python.org
> Subject: Re: Please help with Threading
>
> On 19May2013 03:02, Carlos Nepomuceno wrote:
> | Just been told that GIL doesn't ma
On 20May2013 07:25, Fábio Santos wrote:
| On 18 May 2013 20:33, "Dennis Lee Bieber" wrote:
| > Python threads work fine if the threads either rely on intelligent
| > DLLs for number crunching (instead of doing nested Python loops to
| > process a numeric array you pass it to something lik
On 20May2013 09:47, Avnesh Shakya wrote:
| On Mon, May 20, 2013 at 9:42 AM, Cameron Simpson wrote:
| > On 19May2013 20:54, Avnesh Shakya wrote:
| > |How to run a python script twice randomly in a day? Actually
| > | I want to run my script randomly in a day and twice only. Please
| > | help
On Mon, May 20, 2013 at 5:05 PM, Frank Millman wrote:
> Hi all
>
> I am trying to emulate a SQL check constraint in Python. Quoting from the
> PostgreSQL docs, "A check constraint is the most generic constraint type. It
> allows you to specify that the value in a certain column must satisfy a
> Bo
It seems to me you can't use ast.literal_eval()[1] to evaluate that kind of
expression because it's just for literals[2].
Why don't you use eval()?
[1] http://docs.python.org/2/library/ast.html#ast-helpers
[2] http://docs.python.org/2/reference/lexical_analysis.html#literals
-
CALL FOR PAPERS:
6th International Workshop on Multi/many-Core Computing Systems
(MuCoCoS-2013)
September 7, 2013, Edinburgh, Scotland, UK
in conjunction with the 22nd Int. Conference on
Parallel Architectures and Compilation Techni
Hi all
I am trying to emulate a SQL check constraint in Python. Quoting from
the PostgreSQL docs, "A check constraint is the most generic constraint
type. It allows you to specify that the value in a certain column must
satisfy a Boolean (truth-value) expression."
The problem is that I want
On 5/20/2013 1:04 AM, Vito De Tullio wrote:
Terry Jan Reedy wrote:
Do you think tkinter is going to be the standard python built-in gui
solution as long as python exists?
AT the moment, there is nothing really comparable that is a realistic
candidate to replace tkinter.
FLTK? (http://www.fl
57 matches
Mail list logo