On Jan 12, 6:09 pm, Alice Bevan–McGregor wrote:
> entirely sure what you mean by 'smart' options. If your'e referring to
> using a single hyphen and a list of characters to represent a long
> option (which, to the rest of the world, use two leading hyphens) then
> that's pretty weird. ;)
>
> One
lst = [1, 2, 3, 4, 5]
def maketup(lst):
cur_item = lst[-1]
lst = lst[:-1]
if len(lst):
return maketup(lst), cur_item
else:
return cur_item
print maketup(lst)
1, 2), 3), 4), 5)
But I'm confused as to what you mean by :
> Among them, I want to pair up terminals
def maketup(lst):
if len(lst) == 1:
return lst[0]
elif len(lst) == 2:
return (lst[0],lst[1])
elif len(lst) > 2:
return ( (maketup(lst[:-2]), lst[-2]), lst[-1])
maketup(lst)
1, 2), 3), 4), 5)
--
http://mail.python.org/mailman/listinfo/python-list
justin writes:
> Suppose I have [1,2,3,4,5], then there are many ways of making
> clustering.
> Among them, I want to pair up terminals until there is only one left
> at the end.
Are you trying "ascending hierarchical clustering" by any chance? In
that case you're supposed to use some kind of di
DevPlayer writes:
> def maketup(lst):
>
> if len(lst) == 1:
> return lst[0]
>
> elif len(lst) == 2:
> return (lst[0],lst[1])
>
> elif len(lst) > 2:
> return ( (maketup(lst[:-2]), lst[-2]), lst[-1])
The OP wants all binary trees over the elements, not just one.
Hello!
I wrote a python (2.6) deamon running on linux. Program (deamon,
manager) collects lets say work-orders from db and creates sub-
processes for each one. Sub-processes do their job with out problems,
errors, exceptions. However, sometimes deamon throws:
Traceback (most recent call last):
tuple([ (tuple(lst[x-1:x+1]) if len(tuple(lst[x-1:x+1]))==2 else
lst[x-1]) for x in lst[::2]])
((1, 2), (3, 4), 5)
# or
x = ((tuple(lst[x-1:x+1]) if len(tuple(lst[x-1:x+1]))==2 else
lst[x-1]) for x in lst[::2])
x.next()
(1, 2)
x.next()
(3, 4)
x.next()
5
--
http://mail.python.org/mailman/listinf
Ah. out of my depth.
--
http://mail.python.org/mailman/listinfo/python-list
> Dear all,
>
> I hope someone out there can help me.
>
> The output string of my code is close to what i need, but i need it
> 1)printed on one line and
> 2) reversed
>
> #mycode:
> s= input("Enter message: ")
> key=1
> for letter in s:
> num=(chr(ord(letter)+1))
> print(num)
> #or
Physics Python wrote:
Hello,
I am teaching myself python using the book: Python Programming for Absolute
Beginners, 2nd edition by Michael Dawson. I am using python 2.7.1.
In chapter 3 we are learning to use structures (while, if, elif) to write a
program that has the user guess a number betw
On Jan 13, 10:02 am, Alain Ketterlin
wrote:
> justin writes:
> > Suppose I have [1,2,3,4,5], then there are many ways of making
> > clustering.
> > Among them, I want to pair up terminals until there is only one left
> > at the end.
>
> Are you trying "ascending hierarchical clustering" by any ch
I would second the recommendation for Django: on LinkedIn, the python jobs
postings (there is a Python group there) most often mention Django.
I also would second the recommendation to participate in open source projects.
I met a couple of days ago with a college sophomore who is a core contrib
Richard Thomas writes:
> On Jan 13, 10:02 am, Alain Ketterlin
>> def clusterings(l):
>> if len(l) == 1:
>> print repr(l)
>> else:
>> n = len(l)
>> for i in xrange(n):
>> for j in xrange(i+1,n):
>> clusterings(l[:i]+l[i+1:j]+l[j+1:]+[[l
On 1/13/2011 5:28 AM, dzizes451 wrote:
Hello!
I wrote a python (2.6) deamon running on linux. Program (deamon,
manager) collects lets say work-orders from db and creates sub-
processes for each one. Sub-processes do their job with out problems,
errors, exceptions. However, sometimes deamon throw
On Jan 13, 3:59 pm, Alain Ketterlin
wrote:
> Richard Thomas writes:
> > On Jan 13, 10:02 am, Alain Ketterlin
> >> def clusterings(l):
> >> if len(l) == 1:
> >> print repr(l)
> >> else:
> >> n = len(l)
> >> for i in xrange(n):
> >> for j in xrange(i+1,n
Hank Fay wrote:
> ...
From a selfish (to you and to me ) perspective, may I suggest
> the pyjamas (pyjs.org) project and accompanying visual designer
> (http://pyjsglade.sourceforge.net), which brings the GWT widgets
> to Python, for desktop and web apps. Selfish to me because I'm
> porting o
Hello Python enthusiasts,
I'm trying to install the "Python Webkit DOM Bindings"
(http://www.gnu.org/software/pythonwebkit/) but am not successful.
The trouble starts when trying to 'make' pywebkitgtk. I've tried the
prepatched version and downloading and patching myself. In both case the
'm
Hey,
--
question
--
How can I use a priority queue to schedule jobs within the "multiprocessing
pool" module?
-
In cases like that instead of sleep() can use pause(). E.g.,
from apscheduler.scheduler import Scheduler
import signal
sched = Scheduler()
sched.start()
def some_job():
print "Decorated job"
sched.add_interval_job(some_job,minutes=1)
signal.pause()
Mosalam
--
http://mail.python.org/mailman/
Peter Otten <__pete...@web.de> writes:
> justin wrote:
>
>> The title sounds too complex, but my question is actually simple.
>>
>> Suppose I have [1,2,3,4,5], then there are many ways of making
>> clustering.
>> Among them, I want to pair up terminals until there is only one left
>> at the end.
Hi,
Is there an equivalent to the textwrap module that knows about the
Unicode line breaking algorithm (UAX #14, http://unicode.org/reports/tr14/
)?
--
http://mail.python.org/mailman/listinfo/python-list
Basically, I have spent a few hours experimenting and searching on the
comp.unix.shell
how to break a command with several switches into more than one line
AND to be able to put some comment on each line.
#!/bin/bash -xv
command \ # comment1
-sw1 \ # comment2
-sw2 \ # com
On Thu, Jan 13, 2011 at 1:18 PM, bolega wrote:
> Basically, I have spent a few hours experimenting and searching on the
> comp.unix.shell
>
> how to break a command with several switches into more than one line
> AND to be able to put some comment on each line.
>
> #!/bin/bash -xv
>
> command
bolega writes:
> Basically, I have spent a few hours experimenting and searching on the
> comp.unix.shell
>
> how to break a command with several switches into more than one line
> AND to be able to put some comment on each line.
>
> #!/bin/bash -xv
>
> command \ # comment1
> -sw1
On Thu, 13 Jan 2011 16:18:31 -0500, bolega wrote:
how to break a command with several switches into more than one line
AND to be able to put some comment on each line.
command \ # comment1
-sw1 \ # comment2
Not what you want to hear, but that will not work. With the above,
the
On Thu, 13 Jan 2011 12:45:31 -0800, leoboiko wrote:
> Hi,
>
> Is there an equivalent to the textwrap module that knows about the
> Unicode line breaking algorithm (UAX #14,
> http://unicode.org/reports/tr14/ )?
Is access to Google blocked where you are, or would you just like us to
do your sea
Hi all,
I have the following problem (which I already have a hacked around
solution that works but I'd would like some more input on it):
I have a situation where multiple python processes are started
independently from each other but by the same user with the same
environment (as happens wi
On Thu, 13 Jan 2011 13:49:06 -0800, Chris Rebert wrote:
> On Thu, Jan 13, 2011 at 1:18 PM, bolega wrote:
>> Basically, I have spent a few hours experimenting and searching on the
>> comp.unix.shell
[...]
> This doesn't seem to have anything whatsoever to do with Python...
Well, I launch Python s
In article ,
Stefan Behnel wrote:
>
>Try
>
> import xml.etree.cElementTree as etree
>
>instead. Note the leading "c", which hints at the C implementations of
>ElementTree. It's much faster and much more memory friendly than the Python
>implementation.
Thanks! I updated our codebase this a
On 2011-01-07 03:24, moerchendiser2k3 wrote:
Everything works fine, the problem starts when I start to make a
circular reference in Python.
I didn't quite grok your example, but concerning CPython GC & circular
references...
>>> import gc
>>> class X:
... def __del__(self):
...
On 2011-01-08 04:24, Ying Zu wrote:
How to read ansic file into a pre-defined class?
I have a series of files written in the following format,
...
You might like to take a look at the json module if you aren't locked to
the exact format you suggested.
http://json.org/
http://docs.python.org
- Original message -
> Hi all,
>
> I have the following problem (which I already have a hacked around
> solution that works but I'd would like some more input on it):
>
> I have a situation where multiple python processes are started
> independently from each other but by the same user
> #!/bin/bash -xv
> command \ # comment1
> -sw1 \ # comment2
> -sw2 \ # comment3
> arguments
> One ought to be able to comment every single switch if desired for
> whatever reason.
Thanks for the riddle. Here's a solution:
command$(: # comment1
)
Hi folks,
I was trying to split the frame into 2 panels using "subplot",
fig = matplotlib.pyplot.figure()
plt1 = fig.add_subplot(2,1,1 )
plt2 = fig.add_subplot(2,1,2 )
plt1.plot(x1, y1, 'g-')
plt2.plot(x2, y2, 'g-')
then I need to overplot other curves on each subplot panel using the
same axes
Arnaud Delobelle wrote:
> more simply:
>
> def clusters(l):
> if len(l) == 1:
> yield l[0]
> return
> for i in range(1, len(l)):
> for left in clusters(l[:i]):
> for right in clusters(l[i:]):
> yield (left, right)
>
> That would give al
35 matches
Mail list logo