En Sun, 03 May 2009 21:41:47 -0300, Deep_Feelings
escribió:
Do you think python online docs are good starting point for me? ( i
experience with other programming languages ) or should i get giant
book or something ?
If you have some previous experience with other languages, I think that
"
On Apr 16, 1:26 pm, Brendon Wickham wrote:
> I agree, no IDE needed. Just don't use Notepad! I'm on Mac, so
> spoiled for choice of text editors, but I'm sure there's one
> or 2 good uns if you're on Windows.
The Zeus for Windows IDE is Python aware:
http://www.zeusedit.com/python.html
It d
Diez B. Roggisch wrote:
Without more code, it's impossible to tell if there is anything
peculiar in your usage of the lib. Maybe you close your connections to
fast to see several open?
Here's the relevant stuff from my (python2.6) code:
CONCURRENCY = 3
def threadProcessRecipient():
# Eac
"norseman" wrote:
> There has to be some way of using a Message or Label (or some) widget as
> a simple posting board.
There is - look at textvariable - an instance of StringVar that is associated
with
the widget.
If all else fails, you can always use configure to change the text...
hth - He
En Mon, 04 May 2009 04:19:21 -0300, Alex Jurkiewicz
escribió:
Diez B. Roggisch wrote:
Without more code, it's impossible to tell if there is anything
peculiar in your usage of the lib. Maybe you close your connections to
fast to see several open?
Here's the relevant stuff from my (python2
"Luis Alberto Zarrabeitia Gomez" wrote:
>Quoting Hendrik van Rooyen :
>> In fact I happen to believe that anything that does any work needs
>> one and only one input queue and nothing else, but I am peculiar
>> that way.
>
>Well, I also need some output. In my case, the outputs are files with th
Steven D'Aprano writes:
> I don't understand why my recursive function hits the recursion
> limit inside the timeit.Timer when it works outside of it.
Probably because your test function is at the very edge of the
recursion limit, and timeit.Timer triggers it because it calls it at a
deeper stac
Gabriel Genellina wrote:
Try logging the start/stop of your threads. It may be that your
threads stop before you think. The above code works correctly only if
you fill the queue before starting any thread - because as soon as a
thread sees the queue empty, it finishes.
You could use the sample
Arnaud Delobelle:
> >>> def bindfunc(f):
> ... def boundf(*args, **kwargs):
> ... return f(boundf, *args, **kwargs)
> ... return boundf
> ...>>> @bindfunc
> ... def fac(self, n):
> ... return 1 if n <= 1 else n * self(n - 1)
> ...>>> fac(5)
> 120
This is cute, now I have two n
CTO wrote:
>> In addition, the zip file format stores the directory at the end of the
>> file. So you can't process it until it's completely downloaded.
>> Concurrency doesn't help here.
>
> Don't think that's relevant, if I'm understanding the OP correctly.
> Lets say you've downloaded the file
Alex Jurkiewicz wrote:
> Gabriel Genellina wrote:
>> Try logging the start/stop of your threads. It may be that your
>> threads stop before you think. The above code works correctly only if
>> you fill the queue before starting any thread - because as soon as a
>> thread sees the queue empty, it f
Diez B. Roggisch wrote:
> Alex Jurkiewicz wrote:
>
>> Gabriel Genellina wrote:
>>> Try logging the start/stop of your threads. It may be that your
>>> threads stop before you think. The above code works correctly only if
>>> you fill the queue before starting any thread - because as soon as a
>>>
Snorri H writes:
> On May 3, 6:13 am, Ross wrote:
>> I'm trying to set up a simple filter using a list comprehension. If I
>> have a list of tuples, a = [(1,2), (3,4), (5,None), (6,7), (8, None)]
>> and I wanted to filter out all tuples containing None, I would like to
>> get the new list b = [(
On May 3, 6:13 am, Ross wrote:
> I'm trying to set up a simple filter using a list comprehension. If I
> have a list of tuples, a = [(1,2), (3,4), (5,None), (6,7), (8, None)]
> and I wanted to filter out all tuples containing None, I would like to
> get the new list b = [(1,2), (3,4),(6,7)].
>
> I
On Mon, May 4, 2009 at 2:33 AM, namekuseijin
wrote:
ls = [(1,2), (3,4), (5, None), (6,7), (8, None)]
[(x,y) for (x,y) in ls if y]
> [(1, 2), (3, 4), (6, 7)]
Nope. That filters out 0 as well as None. Not what the OP asked for.
--
http://mail.python.org/mailman/listinfo/python-list
On May 4, 5:04 am, Matthew Wilson wrote:
> Is there already a tool in the standard library to let me walk up from a
> subdirectory to the top of my file system?
Never seen such a standard tool, yet it can be implemented in a way
like this
def walkup(path):
aux = path.rsplit('/')
while a
On Wed, 15 Apr 2009 22:45:35 +, Benjamin Peterson wrote:
> Why do you think you're wasting time with 2.x?
I'm a relative newbie to python as well but I'd agree that there is at
least a small degree of time "wasted" learning python 2.x simply because
the standard library of python 3.x has been
Hi.
My problem is to replace all occurrences of a sublist with a new element.
Example:
Given ['a','c','a','c','c','g','a','c'] I want to replace all
occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]).
If I do this with string ('acaccgac') I have the advantage of all the
'find' functions,
2009/5/4 :
> An idea-syntax:
>
> def fact(n):
> return 1 if n <= 1 else n * inspect.self(n - 1)
>
> Or even a lambda, because you don't need the name anymore to call the
> function:
>
> fact = lambda n: 1 if n <= 1 else n * self(n - 1)
How would it work with methods?
class Foo:
def fac(se
Hello,
I have this matrix [20*4 - but it could be n*4 , with n~100,000] in
file "EL_list" like this:
1, 1, 2, 3
2, 4, 1, 5
3, 5, 1, 6
4, 7, 5, 6
5, 8, 7, 9
6, 8, 5, 7
7,
On May 4, 2:38 pm, Alexzive wrote:
> Hello,
> I have this matrix [20*4 - but it could be n*4 , with n~100,000] in
> file "EL_list" like this:
>
> 1, 1, 2, 3
> 2, 4, 1, 5
> 3, 5, 1, 6
> 4, 7, 5, 6
> 5, 8,
Matthias Gallé:
> My problem is to replace all occurrences of a sublist with a new element.
> Example:
> Given ['a','c','a','c','c','g','a','c'] I want to replace all
> occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]).
There are several ways to solve this problem. Representing a string as
a
On Mon, 4 May 2009, Matthias Gallé wrote:
> Hi.
>
> My problem is to replace all occurrences of a sublist with a new element.
>
> Example:
> Given ['a','c','a','c','c','g','a','c'] I want to replace all
> occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]).
>
li=['a', 'c', 'a', 'c', 'c', 'g', '
On Mon, May 4, 2009 at 3:01 PM, John O'Hagan wrote:
> On Mon, 4 May 2009, Matthias Gallé wrote:
> > Hi.
> >
> > My problem is to replace all occurrences of a sublist with a new element.
> >
> > Example:
> > Given ['a','c','a','c','c','g','a','c'] I want to replace all
> > occurrences of ['a','c']
Hi,
I am using pylons web framework for my server. I need to get the ip address
of the client machine which made a request to the server in my python code.
How can I do that, I am new to pylons and the existing server has so many
applications. looking forward to get some solutions from the kind fr
Hello all,
I've been spending the last few days experimenting with Tkinter. The
grid manager is nice and easy to use, but I have found that I am often
having to specify padx and pady options to every widget I add to my
grid. The way I am doing it is to create a dictionary:
paddding = {'padx': '1m
Diez B. Roggisch wrote:
Alex Jurkiewicz schrieb:
Hi all,
I'm writing a Python script to do a "mail merge" style email
distribution. I create a few python threads and in each one I call
`smtpserver = smtplib.SMTP(our.smtpserver.com)`. However, during the
sending process, there seems to be only
On May 3, 10:16 pm, John Yeung wrote:
> On May 3, 11:29 pm, Chris Rebert wrote:
>
> > Probably not the cause of the problem, but where
> > did the magic numbers 1.072 and 1.08 come from?
>
> It is perhaps not the most direct cause of the problem, in the sense
> that the magic numbers could take v
Matthias Gallé:
>the int that can replace a sublist can be > 255,<
You didn't specify your integer ranges.
Probably there are many other solutions for your problem, but you have
to give more information. Like the typical array size, typical range
of the numbers, how much important is total memory
Hello,
I have just installed and run python 2.6.2 from the sources available
on the website. I notice that SPE (the editor which i used with python
2.5) is not displaying some of the functions new in 2.6 as
autocomplete options. Is there any IDE with support for autocomplete
in python 2.6 with all
On May 4, 3:57 pm, "Gabriel Genellina" wrote:
> En Mon, 04 May 2009 10:27:49 -0300, Amr escribió:
>
> > I've been spending the last few days experimenting with Tkinter. The
> > grid manager is nice and easy to use, but I have found that I am often
> > having to specify padx and pady options to ev
On May 3, 3:39 pm, bearophileh...@lycos.com wrote:
> Sometimes I rename recursive functions, or I duplicate&modify them,
> and they stop working because inside them there's one or more copy of
> their old name.
> This happens to me more than one time every year.
> So I have written this:
>
> from i
Matthias Gallé wrote:
bearophileh...@lycos.com wrote:
John O'Hagan:
li=['a', 'c', 'a', 'c', 'c', 'g', 'a', 'c']
for i in range(len(li)):
if li[i:i + 2] == ['a', 'c']:
li[i:i + 2] = ['6']
Oh well, I have done a mistake, it seems.
Another solution then:
'acaccgac'.replace("ac", c
bearophileh...@lycos.com wrote:
John O'Hagan:
li=['a', 'c', 'a', 'c', 'c', 'g', 'a', 'c']
for i in range(len(li)):
if li[i:i + 2] == ['a', 'c']:
li[i:i + 2] = ['6']
Oh well, I have done a mistake, it seems.
Another solution then:
'acaccgac'.replace("ac", chr(6))
'\x06\x06cg\x06
On May 4, 7:01 am, Ross wrote:
> On May 3, 10:16 pm, John Yeung wrote:
>
>
>
> > On May 3, 11:29 pm, Chris Rebert wrote:
>
> > > Probably not the cause of the problem, but where
> > > did the magic numbers 1.072 and 1.08 come from?
>
> > It is perhaps not the most direct cause of the problem, in
On May 4, 10:13 am, Soumen banerjee wrote:
> Hello,
> I have just installed and run python 2.6.2 from the sources available
> on the website. I notice that SPE (the editor which i used with python
> 2.5) is not displaying some of the functions new in 2.6 as
> autocomplete options. Is there any IDE
Matthew Wilson wrote:
> Is there already a tool in the standard library to let me walk up from a
> subdirectory to the top of my file system?
>
> In other words, I'm looking for something like:
>
> >>> for x in walkup('/home/matt/projects'):
> ... print(x)
> /home/matt/projects
>
En Mon, 04 May 2009 10:27:49 -0300, Amr escribió:
I've been spending the last few days experimenting with Tkinter. The
grid manager is nice and easy to use, but I have found that I am often
having to specify padx and pady options to every widget I add to my
grid. The way I am doing it is to cre
Alessandro wrote:
On May 4, 2:38 pm, Alexzive wrote:
Hello,
I have this matrix [20*4 - but it could be n*4 , with n~100,000] in
file "EL_list" like this:
1, 1, 2, 3
2, 4, 1, 5
3, 5, 1, 6
4, 7, 5, 6
5,
On 2009-04-24, Steven D'Aprano wrote:
> On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote:
>
>> Hello,
>>
>> I'm trying to do a if statement with a function inside it. I want to use
>> that variable inside that if loop , without defining it.
>>
>> def Test():
>> return 'Vla'
>>
>> I sear
Ok! So, I decided to write a C-extension instead of using ctypes. So
far, I create a module called dnotifier and the handler callback
receives two arguments, the signal number and the respective file
descriptor that was modified.
This works beautifully. Now, I want to release this to the public, s
On May 3, 8:29 pm, John Machin wrote:
> On May 4, 12:36 pm, Ross wrote:
>
>
>
> > For the past couple weeks, I've been working on an algorithm to
> > schedule tennis leagues given court constraints and league
> > considerations (i.e. whether it's a singles or a doubles league). Here
> > were my r
Alexzive wrote:
Hello,
I have this matrix [20*4 - but it could be n*4 , with n~100,000] in
file "EL_list" like this:
1, 1, 2, 3
2, 4, 1, 5
3, 5, 1, 6
4, 7, 5, 6
5, 8, 7, 9
6, 8, 5,
On Sun 03 May 2009 09:24:59 PM EDT, Ben Finney wrote:
> Not every simple function belongs in the standard library :-)
Thanks for the help with this! Maybe I'm overestimating how often
people need this walkup function.
Matt
--
http://mail.python.org/mailman/listinfo/python-list
Snorri H wrote:
> On May 4, 5:04 am, Matthew Wilson wrote:
>> Is there already a tool in the standard library to let me walk up from a
>> subdirectory to the top of my file system?
>
>
> Never seen such a standard tool, yet it can be implemented in a way
> like this
>
> def walkup(path):
>
Hi,
I just wanna know how to set SYSTEM variables and USER variables of windows,
but got no way.
Firstly I thought "os.environ + os.system" may work well, but found no way
to let "os.environ" run to retrive USER variables.
Then I tried win32api, finding the GetEnvironmentVariables() mixing SYSTEM
On May 3, 3:14 pm, Dave Angel wrote:
> flam...@gmail.com wrote:
> > Hello,
> > I am embedding python support in my C++ application and was looking at
> > adding "Intellisense" or "AutoComplete" support.
>
> > I found a way to do it using the "dir" function, but this creates a
> > problem. Here's w
On Monday 04 May 2009 04:01:23 am Hendrik van Rooyen wrote:
> This will form a virtual (or real if you have different machines)
> systolic array with producers feeding consumers that feed
> the summary process, all running concurrently.
Nah, I can't do that. The summary process is expensive, but
In article <8d4ec1df-dddb-469a-99a1-695152db7...@n4g2000vba.googlegroups.com>,
Ross wrote:
>
>def test_round_robin(players, rounds, courts, doubles = False):
>players = range(players)
>for week in round_robin(players,rounds,courts):
> if doubles == True:
> doub
In article ,
=?ISO-8859-1?Q?Matthias_Gall=E9?= wrote:
>
>My problem is to replace all occurrences of a sublist with a new element.
>
>Example:
>Given ['a','c','a','c','c','g','a','c'] I want to replace all
>occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]).
What's your goal? After you do
I just started a project to monitor servers(load, memory, processes,
etc) via ssh(using paramiko). And I was hoping to get some input on
the design of my project, how pythonic it is, etc. It is quite basic
right now. But it is currently able to get load and memory stats from
any number of servers.
On approximately 5/3/2009 7:35 AM, came the following characters from
the keyboard of Ryan Kelly:
Hi All,
I've just released the results of a nice Sunday's coding, inspired by
one too many turns at futzing around with the _winreg module. The
"regobj" module brings a convenient and clean objec
In article <68d22002-fc0a-4590-9395-c78b6ee41...@r34g2000vba.googlegroups.com>,
Alexzive wrote:
>
>I have this matrix [20*4 - but it could be n*4 , with n~100,000] in
>file "EL_list" like this:
Take a look at NumPy
--
Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/
Mike Driscoll wrote:
> On May 4, 10:13 am, Soumen banerjee wrote:
>> Hello,
>> I have just installed and run python 2.6.2 from the sources available
>> on the website. I notice that SPE (the editor which i used with python
>> 2.5) is not displaying some of the functions new in 2.6 as
>> autocompl
On Mon, 4 May 2009, Francesco Guerrieri wrote:
> On Mon, May 4, 2009 at 3:01 PM, John O'Hagan wrote:
> > On Mon, 4 May 2009, Matthias Gallé wrote:
> > > Hi.
> > >
> > > My problem is to replace all occurrences of a sublist with a new
> > > element.
> > >
> > > Example:
> > > Given ['a','c','a','c'
> Which brings us backs to the "20 questions"-part of my earlier post. It
> could be, but it could also be that processing takes seconds. Or it takes
> so long that even concurrency won't help. Who knows?
Probably the OP ;)
Geremy Condra
--
http://mail.python.org/mailman/listinfo/python-list
Dear folks,
I'm just working on a pyQT4 version of my txt to html converter thc (see
listick.org for details).
I created the MainWindow with QT Designer and then converted it to .py
with pyuic4. It works well so far. Then I created a new UI for my
abtDialog (about dialog for my application).
Hi folks,
>From one developer to another, I am looking for some personal
recommendations on what are the best materials for fast tracking an on-
boarding to Python and Django.
I know how to program, get web apps and OO; this is the audience.
I have found some good recommendations and stuff on Am
On May 4, 9:01 am, Matthias Gallé wrote:
> bearophileh...@lycos.com wrote:
> > John O'Hagan:
> >> li=['a', 'c', 'a', 'c', 'c', 'g', 'a', 'c']
> >> for i in range(len(li)):
> >> if li[i:i + 2] == ['a', 'c']:
> >> li[i:i + 2] = ['6']
>
> > Oh well, I have done a mistake, it seems.
> > A
Hi
I have an excel file that is read into python (8000 rows)
from csvimport reader, writer
incsv = reader(open(MY_FILE), dialect='excel')
keys = incsv.next()
There are mixed datatypes.
the last column contains a cumulative frequency running in order
0. to 1. for the 8000 rows
f
Steve Howell:
>two methods with almost identical names, where one function is the public
>interface and then another method that does most of the recursion.<
Thanks Guido & Walter both Python and D support nested functions, so
in such situations I put the recursive function inside the "public
int
For my edification I was looking through the source code of
pychecker. I noticed that there was also a pychecker2 directory
(ubuntu). The pychecker command line tool points to pychecker (w/out
the 2). Does anyone know off the top of their head what this second
directory is about?
thanks
qhfgva
Dear all,
I have to change some lines from a template file, which is rather long
to paste here, but I would like to make some parts of some lines
optional with my command line arguments but I could not see this
directly, I can count the line numbers and decide on this basis to
decide the lines to
grahamdic...@gmail.com wrote:
Hi
I have an excel file that is read into python (8000 rows)
from csvimport reader, writer
incsv = reader(open(MY_FILE), dialect='excel')
keys = incsv.next()
There are mixed datatypes.
the last column contains a cumulative frequency running in order
0.000
bearophileh...@lycos.com writes:
> Steve Howell:
>>two methods with almost identical names, where one function is the
>>public interface and then another method that does most of the
>>recursion.<
>
> Thanks Guido & Walter both Python and D support nested functions, so
> in such situations I put t
utab wrote:
Dear all,
I have to change some lines from a template file, which is rather long
to paste here, but I would like to make some parts of some lines
optional with my command line arguments but I could not see this
directly, I can count the line numbers and decide on this basis to
decide
Arnaud Delobelle:
> def fac(n):
> def rec(n, acc):
> if n <= 1:
> return acc
> else:
> return rec(n - 1, n*acc)
> return rec(n, 1)
Right, that's another way to partially solve the problem I was talking
about. (Unfortunately the performance in Python
In article ,
wrote:
>Arnaud Delobelle:
>>
>> Bearophile, there is a thread on python-ideas about tail-call
>> optimization at the moment.
>
>Someday I'll have to start following those mailing lists...
>But I am not interested in such optimization. It's not going to help
>me significantly. Most t
Grant Rettke writes:
> Hi folks,
>
> From one developer to another, I am looking for some personal
> recommendations on what are the best materials for fast tracking an on-
> boarding to Python and Django.
>
> I know how to program, get web apps and OO; this is the audience.
>
> I have found some
utab wrote:
Dear all,
I have to change some lines from a template file, which is rather long
to paste here, but I would like to make some parts of some lines
optional with my command line arguments but I could not see this
directly, I can count the line numbers and decide on this basis to
decide
On May 4, 9:15 am, David Robinow wrote:
> On Mon, May 4, 2009 at 2:33 AM, namekuseijin
>
> wrote:
> ls = [(1,2), (3,4), (5, None), (6,7), (8, None)]
> [(x,y) for (x,y) in ls if y]
> > [(1, 2), (3, 4), (6, 7)]
>
> Nope. That filters out 0 as well as None. Not what the OP asked for.
True
On Mon, 2009-05-04 at 19:51 +0100, Arnaud Delobelle wrote:
>
> Bearophile, there is a thread on python-ideas about tail-call
> optimization at the moment.
Oooh - haven't noticed that (and don't have time to follow it), but has
anyone seen the results I got a week or so ago from briefly playing wi
Aahz:
> When have you ever had a binary tree a thousand levels deep?
Yesterday.
>Consider how big 2**1000 is...<
You are thinking just about complete binary trees.
But consider that a topology like a single linked list (every node has
1 child, and they are chained) is a true binary tree still.
On May 4, 12:15 pm, a...@pythoncraft.com (Aahz) wrote:
> In article <8d4ec1df-dddb-469a-99a1-695152db7...@n4g2000vba.googlegroups.com>,
>
> Ross wrote:
>
> >def test_round_robin(players, rounds, courts, doubles = False):
> > players = range(players)
> > for week in round_robin(players,round
flam...@gmail.com wrote:
On May 3, 3:14 pm, Dave Angel wrote:
flam...@gmail.com wrote:
Hello,
I am embedding python support in my C++ application and was looking at
adding "Intellisense" or "AutoComplete" support.
I found a way to do it using the "dir" function, but this creates
Soumen banerjee wrote:
Hello,
I have just installed and run python 2.6.2 from the sources available
on the website. I notice that SPE (the editor which i used with python
2.5) is not displaying some of the functions new in 2.6 as
autocomplete options. Is there any IDE with support for autocomplet
Matthew Wilson wrote:
On Sun 03 May 2009 09:24:59 PM EDT, Ben Finney wrote:
Not every simple function belongs in the standard library :-)
Thanks for the help with this! Maybe I'm overestimating how often
people need this walkup function.
Matt
Look at os.path.normpath(os.path.j
> Alex Jurkiewicz (AJ) wrote:
>AJ> def threadProcessRecipient():
[snip]
>AJ> if __name__ == '__main__':
>AJ>THREADS = []
>AJ>for i in range(CONCURRENCY):
>AJ>THREADS.append(threading.Thread(target=threadProcessRecipient))
>AJ>for thread in THREADS:
>AJ>thread.run()
watch out for:
for i in file... often returns just one character at a time,
meaning you will have to track EOL's yourself OR
import the readline and use it to stand a better chance of getting what
you expect from a read file function.
Today: 20090504
Logic outline, No particular version
watch out for:
for i in file... often returns just one character at a time,
meaning you will have to track EOL's yourself OR
import the readline and use it to stand a better chance of getting what
you expect from a read file function.
Today: 20090504
Logic outline, No particular versio
On Mon, May 4, 2009 at 1:25 PM, wrote:
> Aahz:
>> When have you ever had a binary tree a thousand levels deep?
>
> Yesterday.
>
>
>>Consider how big 2**1000 is...<
>
> You are thinking just about complete binary trees.
> But consider that a topology like a single linked list (every node has
> 1 c
> gganesh (g) wrote:
>g> Hi friends,
>g> I suppose sendmail() can send mails one by one ,how to send mails
>g> concurrently ,
>g> It would be very grateful,if someone could point out a solution.
There is a discussion about this in the thread `Threaded alternatives to
smtplib?'
--
Piet van
Allan Yuan wrote:
Hi,
I just wanna know how to set SYSTEM variables and USER variables of windows,
but got no way.
Firstly I thought "os.environ + os.system" may work well, but found no way
to let "os.environ" run to retrive USER variables.
Then I tried win32api, finding the GetEnvironmentVaria
bearophileh...@lycos.com writes:
> Aahz:
>> When have you ever had a binary tree a thousand levels deep?
>
> Yesterday.
>
>
>>Consider how big 2**1000 is...<
>
> You are thinking just about complete binary trees.
> But consider that a topology like a single linked list (every node has
> 1 child, a
On Mon, 04 May 2009 15:25:44 +0100, Antoon Pardon
wrote:
On 2009-04-24, Steven D'Aprano
wrote:
On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote:
Hello,
I'm trying to do a if statement with a function inside it. I want to
use
that variable inside that if loop , without defining it
En Mon, 04 May 2009 15:12:41 -0300, mzdude escribió:
substring isn't limited to 0..255
substring = "\0x%d\0x%d" % (257,257)
'acaccgac'.replace("ac", substring)
'\x00x257\x00x257\x00x257\x00x257cg\x00x257\x00x257'
This isn't what you think it is. Look carefully:
py> substring = "\0x%d\0x%d"
bearophileh...@lycos.com wrote:
Another possible syntax:
def fact(n):
return 1 if n <= 1 else n * return(n - 1)
But I guess most people don't see this problem as important&common
enough to justify changing the language.
Actually, I would like a way to refer to the current function from
Matthias Gallé wrote:
Hi.
My problem is to replace all occurrences of a sublist with a new element.
Example:
Given ['a','c','a','c','c','g','a','c'] I want to replace all
occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]).
If I do this with string ('acaccgac') I have the advantage of all
In a python program I ask if the user wants to continue. If they answer
'no', what options do I have to halt execution? I can put the rest of the
code inside an "if bContinue:" block, but that seems awkward. I have
looked at raising an exception, and perhaps this is the preferred method,
but
On Mon, May 4, 2009 at 3:02 PM, wrote:
>
> In a python program I ask if the user wants to continue. If they answer
> 'no', what options do I have to halt execution? I can put the rest of the
> code inside an "if bContinue:" block, but that seems awkward. I have looked
> at raising an exception
Rhodri James wrote:
On Mon, 04 May 2009 15:25:44 +0100, Antoon Pardon
wrote:
On 2009-04-24, Steven D'Aprano
wrote:
On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote:
Hello,
I'm trying to do a if statement with a function inside it. I want to
use
that variable inside that if loop , w
flam...@gmail.com wrote:
... Using this code, I can get information like the name of the symbol
(x), but I can't figure out how to get the type. If I knew how to get
this it would solve 99% of my problems :)
If Python were statically typed, you might be correct.
A _value_ in python has a type,
robert.t.ly...@seagate.com wrote:
In a python program I ask if the user wants to continue. If they answer
'no', what options do I have to halt execution? I can put the rest of
the code inside an "if bContinue:" block, but that seems awkward. I
have looked at raising an exception, and perha
On May 3, 12:22 am, CM wrote:
> On May 2, 4:36 pm, seanm...@gmail.com wrote:
>
>
>
> > I am going to try posting here again with more detail to see if I can
> > finally get my first program to work.
>
> > I am working on a MacBook Pro with OS X 10.4.11. I opened a new window
> > in IDLE to create
> > I've just released the results of a nice Sunday's coding, inspired by
> > one too many turns at futzing around with the _winreg module. The
> > "regobj" module brings a convenient and clean object-based API for
> > accessing the Windows Registry.
>
> Sounds very interesting, Ryan. Just a c
Arnaud Delobelle wrote:
In that case the following would not grow the stack, given tail-call
optimization:
def visit(node):
print 'visiting', node
if node.right is None:
return visit(node.left)
if node.left is not None:
visit(node.left)
return visit(node.right)
En Mon, 04 May 2009 19:14:53 -0300, Chris Rebert escribió:
On Mon, May 4, 2009 at 3:02 PM, wrote:
In a python program I ask if the user wants to continue. If they answer
'no', what options do I have to halt execution? I can put the rest of
the
code inside an "if bContinue:" block, but th
Antoon Pardon wrote:
On 2009-04-24, Steven D'Aprano wrote:
On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote:
Hello,
I'm trying to do a if statement with a function inside it. I want to use
that variable inside that if loop , without defining it.
def Test():
return 'Vla'
I searching
MRAB wrote:
If you're not limited to ASCII then there's '←' (U+2190, 'LEFTWARDS
ARROW'). It's a little too late now, though.
Well, if you are old enough, that was the ASCII graphic for the
character now printed as '_' (ASCII), and SAIL used it for assignment
statements, causing much consternatio
On May 4, 1:25 pm, bearophileh...@lycos.com wrote:
> Aahz:
>
> > When have you ever had a binary tree a thousand levels deep?
>
> Yesterday.
>
> >Consider how big 2**1000 is...<
>
> You are thinking just about complete binary trees.
> But consider that a topology like a single linked list (every no
1 - 100 of 131 matches
Mail list logo