בתאריך יום ראשון, 16 בספטמבר 2012 01:43:31 UTC+3, מאת Dan Katorza:
> בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת Dan Katorza:
>
> > hello ,
>
> >
>
> >
>
> >
>
> > i'm new to Python and i searched the web and could not find an answer for
> > my issue.
>
> >
>
> >
>
> >
>
>
On 18/09/12 05:01:14, Ian Kelly wrote:
> On Mon, Sep 17, 2012 at 7:08 PM, David Smith wrote:
>> How do I "indent" if I have something like:
>> if (sR=='Cope'): sys.exit(1) elif (sR=='Perform') sys.exit(2) else
>> sys.exit(3)
>
> How about:
>
> if sR == 'Cope':
> sys.exit(1)
> elif sR == 'Per
On Wed, Sep 19, 2012 at 5:41 PM, Dan Katorza wrote:
>
> Hello again,
> I have another question and i hope you will understand me..
> Is there any option where you can set the program to go back to lets say the
> top of the code?
> I mean if the program finished the operation and i want to stay in
בתאריך יום רביעי, 19 בספטמבר 2012 11:14:29 UTC+3, מאת Chris Angelico:
> On Wed, Sep 19, 2012 at 5:41 PM, Dan Katorza wrote:
>
> >
>
> > Hello again,
>
> > I have another question and i hope you will understand me..
>
> > Is there any option where you can set the program to go back to lets say
On Wed, Sep 19, 2012 at 6:50 PM, Dan Katorza wrote:
> i know about the while loop , but forgive me i just don't have a clue how to
> use it for this situation.
You've already used one. What you need to do is surround your entire
code with the loop, so that as soon as it gets to the bottom, it go
בתאריך יום רביעי, 19 בספטמבר 2012 11:50:56 UTC+3, מאת Dan Katorza:
> בתאריך יום רביעי, 19 בספטמבר 2012 11:14:29 UTC+3, מאת Chris Angelico:
>
> > On Wed, Sep 19, 2012 at 5:41 PM, Dan Katorza wrote:
>
> >
>
> > >
>
> >
>
> > > Hello again,
>
> >
>
> > > I have another question and i hope y
Am 18.09.2012 15:03 schrieb David Smith:
I COULD break down each batch file and write dozens of mini python
scripts to be called. I already have a few, too. Efficiency? Speed is
bad, but these are bat files, after all. The cost of trying to work with
a multitude of small files is high, though, a
One thing that is cooler with java-script than in python is that dictionaries
and objects are the same thing. It allows browsing of complex hierarchical data
syntactically easy.
For manipulating complex jsonable data, one will always prefer writing:
buildrequest.properties.myprop
rather than
brd
2012/9/18 Dennis Lee Bieber :
>
> Unless you have a really massive result set from that "ls", that
> command probably ran so fast that it is blocked waiting for someone to
> read the PIPE.
I tried also with "ls -lR /" and that definitively takes a while to run,
when I do this:
proc = subp
I have a list of dictionaries. They all have the same keys. I want to find
the
set of keys where all the dictionaries have the same values. Suggestions?
--
http://mail.python.org/mailman/listinfo/python-list
Neal Becker wrote:
> I have a list of dictionaries. They all have the same keys. I want to
> find the set of keys where all the dictionaries have the same values.
Suggestions?
>>> items = [
... {1:2, 2:2},
... {1:1, 2:2},
... ]
>>> first = items[0].items()
>>> [key for key, value in first if
Neal Becker writes:
> I have a list of dictionaries. They all have the same keys. I want
> to find the set of keys where all the dictionaries have the same
> values. Suggestions?
Literally-ish:
{ key for key, val in ds[0].items() if all(val == d[key] for d in ds) }
--
http://mail.python.org/m
On 09/19/2012 06:24 AM, Pierre Tardy wrote:
> One thing that is cooler with java-script than in python is that dictionaries
> and objects are the same thing. It allows browsing of complex hierarchical
> data syntactically easy.
You probably need some different terminology, since a dictionary is
> I have a list of dictionaries. They all have the same keys. I want to find
> the
> set of keys where all the dictionaries have the same values. Suggestions?
Here is my solution:
a = {}
a['dict'] = 1
b = {}
b['dict'] = 2
c = {}
c['dict'] = 1
d = {}
d['dict'] = 3
e = {}
e['dict'] = 1
x
Dwight Hutto wrote:
>> I have a list of dictionaries. They all have the same keys. I want to
>> find the
>> set of keys where all the dictionaries have the same values.
>> Suggestions?
>
> Here is my solution:
>
>
> a = {}
> a['dict'] = 1
>
> b = {}
> b['dict'] = 2
>
> c = {}
> c['dict'] =
On 19-09-12 13:17, Neal Becker wrote:
> I have a list of dictionaries. They all have the same keys. I want to find
> the
> set of keys where all the dictionaries have the same values. Suggestions?
common_items = reduce(opereator.__and__, [set(dct.iteritems()) for dct
in lst])
common_keys = set
On 2012-09-19 05:22, Thomas Rachel wrote:
Am 18.09.2012 15:03 schrieb David Smith:
I COULD break down each batch file and write dozens of mini python
scripts to be called. I already have a few, too. Efficiency? Speed is
bad, but these are bat files, after all. The cost of trying to work with
a
On Wed, Sep 19, 2012 at 8:01 AM, Dwight Hutto wrote:
>> I have a list of dictionaries. They all have the same keys. I want to find
>> the
>> set of keys where all the dictionaries have the same values. Suggestions?
>
This one is better:
a = {}
a['dict'] = 1
b = {}
b['dict'] = 2
c = {}
c['d
בתאריך יום רביעי, 19 בספטמבר 2012 12:11:04 UTC+3, מאת Dan Katorza:
> בתאריך יום רביעי, 19 בספטמבר 2012 11:50:56 UTC+3, מאת Dan Katorza:
>
> > בתאריך יום רביעי, 19 בספטמבר 2012 11:14:29 UTC+3, מאת Chris Angelico:
>
> >
>
> > > On Wed, Sep 19, 2012 at 5:41 PM, Dan Katorza wrote:
>
> >
>
> > >
- Original Message -
> Jean-Michel Pichavant writes:
>
> > - Original Message -
> >> Jean-Michel Pichavant wrote:
> > [snip]
> >> One minor note, the style of decorator you are using loses the
> >> docstring
> >> (at least) of the original function. I would add the
> >> @functoo
On 19/09/12 12:26:30, andrea crotti wrote:
> 2012/9/18 Dennis Lee Bieber :
>>
>> Unless you have a really massive result set from that "ls", that
>> command probably ran so fast that it is blocked waiting for someone to
>> read the PIPE.
>
> I tried also with "ls -lR /" and that definitive
On 2012-09-19, Dave Angel wrote:
> On 09/19/2012 06:24 AM, Pierre Tardy wrote:
>> All implementation I tried are much slower than a pure native dict access.
>>
Each implementation have bench results in commit comment. All of them
>> are 20+x slower than plain dict!
>
> Assuming you're talking ab
Am 19.09.2012 12:24 schrieb Pierre Tardy:
One thing that is cooler with java-script than in python is that dictionaries
and objects are the same thing. It allows browsing of complex hierarchical data
syntactically easy.
For manipulating complex jsonable data, one will always prefer writing:
b
Hello,
I wonder why sum does not work on the string sequence in Python 3 :
>>> sum((8,5,9,3))
25
>>> sum([5,8,3,9,2])
27
>>> sum('rtarze')
TypeError: unsupported operand type(s) for +: 'int' and 'str'
I naively thought that sum('abc') would expand to 'a'+'b'+'c'
And the error message is somewhat
On Wed, Sep 19, 2012 at 10:41 AM, Franck Ditter wrote:
> Hello,
> I wonder why sum does not work on the string sequence in Python 3 :
>
sum((8,5,9,3))
> 25
sum([5,8,3,9,2])
> 27
sum('rtarze')
> TypeError: unsupported operand type(s) for +: 'int' and 'str'
>
> I naively thought that
On 2012-09-19, Franck Ditter wrote:
> Hello,
> I wonder why sum does not work on the string sequence in Python 3 :
>
sum((8,5,9,3))
> 25
sum([5,8,3,9,2])
> 27
sum('rtarze')
> TypeError: unsupported operand type(s) for +: 'int' and 'str'
>
> I naively thought that sum('abc') would ex
On Wed, Sep 19, 2012 at 8:41 AM, Franck Ditter wrote:
> Hello,
> I wonder why sum does not work on the string sequence in Python 3 :
>
sum((8,5,9,3))
> 25
sum([5,8,3,9,2])
> 27
sum('rtarze')
> TypeError: unsupported operand type(s) for +: 'int' and 'str'
>
> I naively thought that s
On 2012-09-19, Ian Kelly wrote:
> It notes in the doc string that it does not work on strings:
>
> sum(...)
> sum(sequence[, start]) -> value
>
> Returns the sum of a sequence of numbers (NOT strings) plus
> the value of parameter 'start' (which defaults to 0). When
> the sequence
On Wed, 19 Sep 2012 16:41:20 +0200, Franck Ditter wrote:
> Hello,
> I wonder why sum does not work on the string sequence in Python 3 :
>
sum((8,5,9,3))
> 25
sum([5,8,3,9,2])
> 27
sum('rtarze')
> TypeError: unsupported operand type(s) for +: 'int' and 'str'
>
> I naively thought t
On Wed, Sep 19, 2012 at 6:13 AM, Antoon Pardon
wrote:
> On 19-09-12 13:17, Neal Becker wrote:
>> I have a list of dictionaries. They all have the same keys. I want to find
>> the
>> set of keys where all the dictionaries have the same values. Suggestions?
> common_items = reduce(opereator.__an
On Wed, Sep 19, 2012 at 9:06 AM, Neil Cerutti wrote:
> Are iterables and sequences different enough to warrant posting a
> bug report?
The glossary is specific about the definitions of both, so I would say yes.
http://docs.python.org/dev/glossary.html#term-iterable
http://docs.python.org/dev/glo
On Sep 19, 8:06 am, Neil Cerutti wrote:
> On 2012-09-19, Ian Kelly wrote:
>
> > It notes in the doc string that it does not work on strings:
>
> > sum(...)
> > sum(sequence[, start]) -> value
>
> > Returns the sum of a sequence of numbers (NOT strings) plus
> > the value of parameter
On Wednesday 19 September 2012 11:56:44 Hans Mulder did opine:
> On 19/09/12 12:26:30, andrea crotti wrote:
> > 2012/9/18 Dennis Lee Bieber :
> >> Unless you have a really massive result set from that "ls",
> >> that
> >>
> >> command probably ran so fast that it is blocked waitin
On Wed, 19 Sep 2012 09:03:03 -0600, Ian Kelly wrote:
> I think this restriction is mainly for efficiency. sum(['a', 'b', 'c',
> 'd', 'e']) would be the equivalent of 'a' + 'b' + 'c' + 'd' + 'e', which
> is an inefficient way to add together strings.
It might not be obvious to some people why rep
>
> This has been proposed and discussed and even implemented many
> times on this list and others.
>
I can find this question on SO
http://stackoverflow.com/questions/4984647/accessing-dict-keys-like-an-attribute-in-python
which is basically answered with this solution
class AttributeDict(dict):
On Wed, 19 Sep 2012 15:07:04 +, Alister wrote:
> Summation is a mathematical function that works on numbers Concatenation
> is the process of appending 1 string to another
>
> although they are not related to each other they do share the same
> operator(+) which is the cause of confusion. att
2012/9/19 Hans Mulder :
> Yes: using "top" is an observation problem.
>
> "Top", as the name suggests, shows only the most active processes.
Sure but "ls -lR /" is a very active process if you try to run it..
Anyway as written below I don't need this anymore.
>
> It's quite possible that your 'ls
2012/9/19 Trent Nelson :
>
> FWIW, I gave a presentation on decorators to the New York Python
> User Group back in 2008. Relevant blog post:
>
> http://blogs.onresolve.com/?p=48
>
> There's a link to the PowerPoint presentation I used in the first
> paragraph. It's in .ppt
On Sep 19, 2012 9:37 AM, "andrea crotti" wrote:
> Well there is a process which has to do two things, monitor
> periodically some external conditions (filesystem / db), and launch a
> process that can take very long time.
>
> So I can't put a wait anywhere, or I'll stop everything else. But at
>
Neal Becker writes:
> I have a list of dictionaries. They all have the same keys. I want to find
> the
> set of keys where all the dictionaries have the same values. Suggestions?
Untested, and uses a few more comparisons than necessary:
# ds = [dict1, dict2 ... ]
d0 = ds[0]
ks = set(k for
Hello list
>From man 2 EXECVE
"By default, file descriptors remain open across an execve()"
And from man 2 FCNTL
"Record locks are... preserved across an execve(2)."
So the question:
* If I execve a python script (from C), how can I retrieve the list of
files, and optionally the list of locks, f
On 19/09/12 18:34:58, andrea crotti wrote:
> 2012/9/19 Hans Mulder :
>> Yes: using "top" is an observation problem.
>>
>> "Top", as the name suggests, shows only the most active processes.
>
> Sure but "ls -lR /" is a very active process if you try to run it..
Not necessarily:
>> It's quite poss
On Tue, 2012-09-18 at 22:12 -0600, Jason Friedman wrote:
> > I'm converting windows bat files little by little to Python 3 as I find time
> > and learn Python.
> > The most efficient method for some lines is to call Python like:
> > python -c "import sys; sys.exit(3)"
> >
> > How do I "indent" if I
On 9/19/2012 8:27 AM, David Smith wrote:
but not:
print('hi');if 1: print('hi')
Chokes on the 'if'. On the surface, this is not consistent.
Yes it is. ; can only be followed by simple statements. The keyword for
compound statememts must be the first non-indent token on a line. That
is why I
On 09/19/2012 08:28 AM, Dan Katorza wrote:
> בתאריך יום רביעי, 19 בספטמבר 2012 12:11:04 UTC+3, מאת Dan Katorza:
>>
>> hi, ll like
>> found a solution,
>> it's not quite like Chris advised but it works.
Not at all like Chris advised. But it also doesn't help you understand
programming. Two conce
On 19/09/12 19:51:44, Albert Hopkins wrote:
> On Tue, 2012-09-18 at 22:12 -0600, Jason Friedman wrote:
>>> I'm converting windows bat files little by little to Python 3 as I find time
>>> and learn Python.
>>> The most efficient method for some lines is to call Python like:
>>> python -c "import sy
Hello all:
This is my first shot with UWSGI and Python on Nginx, and I'm getting
kind of confused.
My uwsgi init script looks like:
#!/bin/sh
#/etc/init.d/uwsgi
### BEGIN INIT INFO
# Provides: uwsgi
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### E
On Wed, Sep 19, 2012 at 9:37 AM, Steve Howell wrote:
> Sequences are iterables, so I'd say the docs are technically correct,
> but maybe I'm misunderstanding what you would be trying to clarify.
The doc string suggests that the argument to sum() must be a sequence,
when in fact any iterable will
On Sep 19, 11:34 am, Ian Kelly wrote:
> On Wed, Sep 19, 2012 at 9:37 AM, Steve Howell wrote:
> > Sequences are iterables, so I'd say the docs are technically correct,
> > but maybe I'm misunderstanding what you would be trying to clarify.
>
> The doc string suggests that the argument to sum() mus
On 9/19/2012 11:07 AM, Alister wrote:
Summation is a mathematical function that works on numbers
Concatenation is the process of appending 1 string to another
although they are not related to each other they do share the same
operator(+) which is the cause of confusion.
If one represents coun
Folks,
I asked the same query on the python tutor mailing list.
The responses i received are here :
http://thread.gmane.org/gmane.comp.python.tutor/77601
Mark,
There is nothing wrong in asking a query on multiple forums.
Poeple on the tutor list, may not be part of comp.lang.python & subscribe
andrea crotti於 2012年9月20日星期四UTC+8上午12時42分50秒寫道:
> 2012/9/19 Trent Nelson :
>
> >
>
> > FWIW, I gave a presentation on decorators to the New York Python
>
> > User Group back in 2008. Relevant blog post:
>
> >
>
> > http://blogs.onresolve.com/?p=48
>
> >
>
> > There's a l
Hi PyTutor Folks
Here is my situation
1. I have two machines. Lets call them local & remote.
Both run ubuntu & both have python installed
2. I have a python script, local.py, running on local which needs to pass
arguments ( 3/4 string arguments, containing whitespaces like spaces, etc ) to
a p
Hi c.l.p folks
Here is my situation
1. I have two machines. Lets call them 'local' & 'remote'.
Both run ubuntu & both have python installed
2. I have a python script, local.py, running on 'local' which needs to pass
arguments ( 3/4 string arguments, containing whitespaces like spaces, etc ) to
On 2012-09-19 14:18, Terry Reedy wrote:
stating correctly that it works for exec().
My mistake. I fancied you were talking shell, not python. I now see that
Python 3 has exec() as a built-in.
python -c "exec('print(\"hi\")\nif 0:\n print(\"hi\")\nelif 1:\n
print(\"hi2\")')"
worked right of
2012/9/19 ashish :
> Hi c.l.p folks
>
> Here is my situation
>
> 1. I have two machines. Lets call them 'local' & 'remote'.
> Both run ubuntu & both have python installed
>
> 2. I have a python script, local.py, running on 'local' which needs to pass
> arguments ( 3/4 string arguments, containing
2012/9/19 Ismael Farfán :
> Hello list
>
> From man 2 EXECVE
> "By default, file descriptors remain open across an execve()"
>
> And from man 2 FCNTL
> "Record locks are... preserved across an execve(2)."
>
> So the question:
> * If I execve a python script (from C), how can I retrieve the list of
On Wed, Sep 19, 2012 at 11:34 AM, Ismael Farfán wrote:
> So the question:
> * If I execve a python script (from C), how can I retrieve the list of
> files, and optionally the list of locks, from within the execve(d)
> python process so that I can use them?
>
>
> Some more info:
> I'm working with
On Wed, Sep 19, 2012 at 2:36 PM, Ismael Farfán wrote:
> It seems like I can use os.fstat to find out if a fd exists and also
> get it's type and mode (I'm getting some pipes too : )
Sure, because files and pipes both use the file descriptor
abstraction. If your process does any networking, you'l
2012/9/19 Ian Kelly :
> On Wed, Sep 19, 2012 at 2:36 PM, Ismael Farfán wrote:
>> It seems like I can use os.fstat to find out if a fd exists and also
>> get it's type and mode (I'm getting some pipes too : )
>
> Sure, because files and pipes both use the file descriptor
> abstraction. If your pro
On 19/09/12 17:07:04, Alister wrote:
> On Wed, 19 Sep 2012 16:41:20 +0200, Franck Ditter wrote:
>
>> Hello,
>> I wonder why sum does not work on the string sequence in Python 3 :
>>
> sum((8,5,9,3))
>> 25
> sum([5,8,3,9,2])
>> 27
> sum('rtarze')
>> TypeError: unsupported operand type(s
On 2012-09-19, Pierre Tardy wrote:
> --===1362296571==
> Content-Type: multipart/alternative; boundary=bcaec554d3229e814204ca105e50
>
> --bcaec554d3229e814204ca105e50
> Content-Type: text/plain; charset=ISO-8859-1
>
>>
>> This has been proposed and discussed and even implemented many
Am 19.09.2012 19:34, schrieb Ismael Farfán:
> Hello list
>
> From man 2 EXECVE
> "By default, file descriptors remain open across an execve()"
>
> And from man 2 FCNTL
> "Record locks are... preserved across an execve(2)."
>
> So the question:
> * If I execve a python script (from C), how can I
Does anyone know how to install Pip onto a mac os x ver 10.7.4?
Ive tried easy_instal pip but it brings up this message (but it doesn't help
with my problem):
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
install
On Sep 19, 2012 6:37 PM, "John Mordecai Dildy" wrote:
>
> Does anyone know how to install Pip onto a mac os x ver 10.7.4?
>
> Ive tried easy_instal pip but it brings up this message (but it doesn't
help with my problem):
>
> error: can't create or remove files in install directory
>
> The followin
On Thu, Sep 20, 2012 at 7:09 AM, Ian Kelly wrote:
> You could do:
>
> os.listdir("/proc/%d/fd" % os.getpid())
>
> This should work on Linux, AIX, and Solaris, but obviously not on Windows.
I'm not sure how cross-platform it is, but at least on Linux, you can
use /proc/self as an alias for "/proc/
> Ask the user for the amount of change expressed in cents. Your program must
> compute and display the number of half-dollars, quarters, dimes, nickels,
> and pennies to be returned.
> Return as many half-dollars as possible, then quarters, dimes, nickels, and
> pennies, in that order.
> Your prog
ashish wrote:
>
>Here is my situation
>
>1. I have two machines. Lets call them 'local' & 'remote'.
>Both run ubuntu & both have python installed
>
>2. I have a python script, local.py, running on 'local' which needs to pass
>arguments ( 3/4 string arguments, containing whitespaces like spaces, et
2012/9/19 Christian Heimes :
>> So the question:
>> * If I execve a python script (from C), how can I retrieve the list of
>> files, and optionally the list of locks, from within the execve(d)
>> python process so that I can use them?
>
> Have a look at psutil:
>
> http://code.google.com/p/psutil/#
On Wed, 19 Sep 2012 12:46:33 -0700, ashish wrote:
> Hi PyTutor Folks
>
> Here is my situation
>
> 1. I have two machines. Lets call them local & remote. Both run ubuntu &
> both have python installed
>
> 2. I have a python script, local.py, running on local which needs to
> pass arguments ( 3/4
On Thu, Sep 20, 2012 at 2:27 PM, Steven D'Aprano
wrote:
> On Wed, 19 Sep 2012 12:46:33 -0700, ashish wrote:
>
>> 2. I have a python script, local.py, running on local which needs to
>> pass arguments ( 3/4 string arguments, containing whitespaces like
>> spaces, etc ) to a python script, remote.py
בתאריך יום רביעי, 19 בספטמבר 2012 15:28:23 UTC+3, מאת Dan Katorza:
> בתאריך יום רביעי, 19 בספטמבר 2012 12:11:04 UTC+3, מאת Dan Katorza:
>
> > בתאריך יום רביעי, 19 בספטמבר 2012 11:50:56 UTC+3, מאת Dan Katorza:
>
> >
>
> > > בתאריך יום רביעי, 19 בספטמבר 2012 11:14:29 UTC+3, מאת Chris Angelico:
>
72 matches
Mail list logo