Paolo Pantaleo wrote:
> I have a function
>
> def f(the_arg):
> ...
>
> and I want to state that the_arg must be only of a certain type
> (actually a list). Is there a way to do that?
You can state that in your documentation.
You're very likely to get a reasonable runtime error
from this when y
In <[EMAIL PROTECTED]>, K.S.Sreeram
wrote:
> Marc 'BlackJack' Rintsch wrote:
>> But why use a metaclass? If the meta class is only applied to *one*
>> class, can't you do at class level whatever the metaclass is doing!?
>
> The very fact that you can put a loop inside __metaclass__ may be reason
Rene Pijlman schrieb:
> Bruno Desthuilliers:
>> Java interfaces are a workaround
>
> Troll alert.
No idea how you come to that conclusion - but he is actually right with
that.
Diez
--
http://mail.python.org/mailman/listinfo/python-list
Marc 'BlackJack' Rintsch wrote:
> What do you mean by 'fileformats'? A script that automagically converts
> *anything* to text? What about pictures?
that's a one-and-a-half-liner:
import Image, sys; print list(Image.open(sys.argv[1]).getdata())
--
http://mail.python.org/mailman/list
"yaru22" wrote:
> In one of the examples in the book I'm reading, it says:
>
> def __init__(self):
>...
>...
>...
>return
>
> It has nothing after "return". I expected it to have some number like 0 or 1.
>
> What does it mean to have nothing after return?
"return" is the same thi
Oliver Bandel schrieb:
> Matthias Blume wrote:
>
>> Tin Gherdanarra <[EMAIL PROTECTED]> writes:
>>
>>
>>> Oliver Bandel wrote:
>>>
こんいちわ Xah-Lee san ;-)
>>>
>>> Uhm, I'd guess that Xah is Chinese. Be careful
>>> with such things in real life; Koreans might
>>> beat you up for this. Stay alive
On 2006-07-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> There's a few good reasons.
> 1 - golden handcuffs. Breaking old code is bad 90% of the time
> 2 - creating a set MAY be slower.
>
> Python's sets seem to imply to that they will always be a hash map. in
> this case, some creative hash
The parsing thread reads also the file from the disk.
placid wrote:
> Maximilian Michel wrote:
> > Hi all,
> >
> > I have an interesting problem:
> > I have written code, that reads a logfile and parses it for date string
> > (Thu Jun 29 14:01:23 2006).
> > Standalone everthing works fine, all is
Hi all,
I wonder if somebody had a Sudoko solver written in Python ?
Rony
--
http://mail.python.org/mailman/listinfo/python-list
> > Do you really want "smarmy" here? I don't think it works. Don't you
> > mean "flip" or "smart-alecky" or "facetious"?
>
> Hmm. I think the word we're looking for here is "snarky". ;-)
>
> Although, I confess to ignorance on what a "snark" is or whether
> it is particularly known for brief sel
Andreas Rossberg schrieb:
> AFAICT, ADT describes a type whose values can only be accessed by a
> certain fixed set of operations. Classes qualify for that, as long as
> they provide proper encapsulation.
The first sentence is true if you associate a semantics (i.e. axioms)
with the operations.
Rony Steelandt wrote:
> I wonder if somebody had a Sudoko solver written in Python ?
http://www.google.com/search?q=python+soduko returns some 15000 hits,
including this little gem:
http://norvig.com/sudoku.html
--
http://mail.python.org/mailman/listinfo/python-list
I've got a function that I'd like to improve.
It takes a list of lists and a "target" element, and it returns the set
of the items in the lists that appear either before or after the target
item. (Actually, it's a generator, and I use the set class outside of
it to collect the unique items, but y
Thank you so much!
(2) was the reason!
Without threads, locale.getlocale() returns (None, None), while calling
it in this thread gives back ('de_DE', 'iso-8859-15').
I'm still curious, why this occurs, but anyway it's fixable with
setlocale(LC_ALL, 'C'); so normally Python doesn't set locales
accor
>
> Take a look at pywinauto, I attended the today talk at EP2006 and seemed
> really cool. http://pywinauto.pbwiki.com
>
Cool, that looks really interesting.
...theres a problem I could solve with that
--
http://mail.python.org/mailman/listinfo/python-list
I have one myself (~400 records). it uses the simplest rules, and then trial
and error, but it works so far.
--
Ángel Gutiérrez Rodríguez - [EMAIL PROTECTED]
Instituto de Ciencia de los Materiales de Madrid - CSIC
SpLine - European Syncrothorn Radiation Facility - Grenoble - France
Postal adress
Rony Steelandt wrote:
> Hi all,
>
> I wonder if somebody had a Sudoko solver written in Python ?
>
> Rony
Dude, there's like a million of them. Try "Sudoko solver Python" in
google.
I wrote one myself based on Knuth's Dancing Links algorithm and using
Tkinter for the gui. I'll send it to you or
Alex Biddle wrote:
> The message in this case was that I /couldn't/ install anything by
> myself as it is on a /shared/ server that's why I wanted to know
> whether there was anything out of the box I could use.
but you did search the library reference TOC and/or the index for "database"
before
Yes, I searched but couldn't find anything. Maybe I wasn't searching
for the right things / in the right places.
I admit I'm more used to forums than mailing lists, but I always make
some effort to search.
On 7/4/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> but you did search the library refere
Alex Martelli wrote:
> Terry Hancock <[EMAIL PROTECTED]> wrote: ...
> > Although, I confess to ignorance on what a "snark" is or whether
>
> http://www.gutenberg.org/etext/13
"The Hunting of the Snark" by Lewis Caroll
Of course! I've heard of it, but never read it. Thanks, Alex. :-)
Not sure
Marc 'BlackJack' Rintsch wrote:
> K.S.Sreeram wrote:
>> The very fact that you can put a loop inside __metaclass__ may be reason
>> enough for a one-off metaclass.
>
> Ah, it's not the loop but the access to the `dict`! You can write loops
> at class level too but I haven't found a way to access
tommak wrote:
> This book, "Next Generation Artificial Intelligence, Artificial Mind
> - Part One - Basic Architecture and Cognitive Structure" introduces a
> basic artificial mind architecture and computational model for
> cognitive processing. Based on the architecture and the
> computationa
"Sybren Stuvel" <[EMAIL PROTECTED]> a écrit dans le
message de news: [EMAIL PROTECTED]
> Rony Steelandt enlightened us with:
>> I wonder if somebody had a Sudoko solver written in Python ?
>
> Check out http://www.stuvel.eu/sodoku - it is a Sudoku game with the
> ability to solve & create new puz
Grant Edwards <[EMAIL PROTECTED]> wrote:
> On 2006-07-03, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
> > Alex Martelli <[EMAIL PROTECTED]> wrote:
> >> DarkBlue <[EMAIL PROTECTED]> wrote:
> >> > try for 10 seconds
> >> >if database.connected :
> >> > do your remote thing
> >> > except ra
"Sybren Stuvel" <[EMAIL PROTECTED]> a écrit dans le
message de news: [EMAIL PROTECTED]
> Rony Steelandt enlightened us with:
>> I wonder if somebody had a Sudoko solver written in Python ?
>
> Check out http://www.stuvel.eu/sodoku - it is a Sudoku game with the
> ability to solve & create new puz
"yaru22" wrote in message
news:[EMAIL PROTECTED]
> In one of the examples in the book I'm reading, it says:
>
> def __init__(self):
> ...
> return
>
> It has nothing after "return". I expected it to have some number like 0
> or 1. What does it mean to have nothing after return?
Yes, it ha
"zefciu" wrote in message news:[EMAIL PROTECTED]
> Where can I find a good explanation when does an interpreter copy the
> value, and when does it create the reference. I thought I understand
> it, but I have just typed in following commands:
>
> >>> a=[[1,2],[3,4]]
> >>> b=a[1]
> >>> b=[5,6]
> >>
You can store the pid of the process when started and later use it to kill it.
cheers,
On 3 Jul 2006 15:28:19 -0700, dfaber <[EMAIL PROTECTED]> wrote:
> Aloha!
> I want to terminate a process/program from within a python script.
>
> For example,
> if I have a program say foo.sh that starts runni
. wrote:
> What is the fast way for a fast implementation of Python?
>
> -- JavaScript implementation of Python
> http://groups.google.it/group/JSython/
Follow the PyPy link. The other replies were about increasing
execution speed, not ease of implementation.
Implement the "RPython" part in
John Machin wrote:
> Apologies in advance if this is a bit bloggy, but I'd like to get
> comments on whether I've lost the plot (or, more likely, failed to
> acquire it) before I start reporting bugs etc.
Please forward to Gerhard Haering if you still
think these are bugs.
Georg
--
http://mai
Hari Sekhon wrote:
> Is it better to do:
> message = """This is line1. This is line2 This is line3\n"""
>
> or
>
> message = "This is line1.\n message = message + "This is line2\n"
> message = message + "This is line3\n"
>
> Since the first method does not follow python's clean and easy
> lo
Hi,
I've embedded python into a legacy application. It works - most of the time.
In some special situations the app crashes executing the "import random".
There are two different situations:
1. the sources compiled with gcc 4.1.2 crash with illegal instruction error:
(running my application)
Joachim Durchholz <[EMAIL PROTECTED]> writes:
> Oliver Bandel schrieb:
>> Matthias Blume wrote:
>>
>>> Tin Gherdanarra <[EMAIL PROTECTED]> writes:
>>>
>>>
Oliver Bandel wrote:
> こんいちわ Xah-Lee san ;-)
Uhm, I'd guess that Xah is Chinese. Be careful
with such things in r
hi
i am working on cgi and wish to gather some input on correct/often used
methods of what i am going to do.
I need to let the user choose (in the form of check boxes) whether they
need the data to be emailed to them periodically. So if they click the
check box on "activate", then email system will
Hello,
If we write = x^2 and if I give to the program the values of x, it will
going to calculate the values of y, and also for x.
But it is possible ? that is if I give to the program the values of X and Y,
it will indicate to me the relation between the two variables, in the other
hand
hi,
I want to change the size of the front in a legend, i wrote this small
program and it got to me this message error!!!
from pylab import *
plot([1,2,3],'r')
legend('this',prop = FontProperties('smaller') )
show()
NameError: name 'FontProperties' is not defined
thanks
--
View this message
[EMAIL PROTECTED] wrote:
> bruce wrote:
>> is there anyone with XPath expertise here? i'm trying to figure out if
>> there's a way to use regex expressions with an xpath query? i've seen
>> references to the ability to use regex and xpath/xml, but i'm not sure how
>> to do it...
>>
>> i have a situ
"Sybren Stuvel" <[EMAIL PROTECTED]> a écrit dans le
message de news: [EMAIL PROTECTED]
> Rony Steelandt enlightened us with:
>> it looks like both zip files are corrupted (for windows platform)?
>
> Can you tell me more? So far I can only tell you that they work just
> fine for me, and 'unzip -t
Rony Steelandt wrote:
> Yes, this is on windows using winzip
> It says the zip file is not a valid zipfile
make sure you save it to disk before opening it.
--
http://mail.python.org/mailman/listinfo/python-list
aliassaf wrote:
> Hello,
>
> If we write = x^2 and if I give to the program the values of x, it will
> going to calculate the values of y, and also for x.
>
> But it is possible ? that is if I give to the program the values of X and Y,
> it will indicate to me the relation between the two
I wrote a python GUI with tkInter and installed it on a windows machinewith the .pyw extension, so it will be executed from pythonw.exe insteadof python.exe, since I didn't want the console window to appear.My application exits with a call to sys.exit. However, when this call isexecuted
I wrote a python GUI with tkInter and installed it on a windows machinewith the .pyw extension, so it will be executed from pythonw.exe insteadof python.exe, since I didn't want the console window to appear.My application exits with a call to sys.exit. However, when this call isexecuted
I wrote a python GUI with tkInter and installed it on a windows machinewith the .pyw extension, so it will be executed from pythonw.exe insteadof python.exe, since I didn't want the console window to appear.My application exits with a call to sys.exit. However, when this call isexecuted under
aliassaf wrote:
> hi,
> I want to change the size of the front in a legend, i wrote this small
> program and it got to me this message error!!!
>
> from pylab import *
> plot([1,2,3],'r')
> legend('this',prop = FontProperties('smaller') )
Try
legend('this',prop = matplotlib.font_manager.FontPro
Hi,
for a school project I'm trying to analyze some python modules. I just
struggeld over a little detail I cannot solve:
shortened example of walking trough an AST with my own visitor:
class MyVisitor:
def visitFunction(self, t):
# Here I do not know know how to associate the defaul
[EMAIL PROTECTED] wrote:
> I can only get a list with the arguments or the defaults. The following
> examples would return the same:
>
> def foo(x, y=True)
> def foo(x=True, y)
the latter is a syntax error.
> Anyone an idea?
the defaults array contains the defaults for the len(defaults) last ar
In <[EMAIL PROTECTED]>, K.S.Sreeram
wrote:
>> BTW, if that's what gangesmaster is after then it seem to work already.
>> Put ``(object)`` after ``X`` and return something, say 'a' and 'b', in the
>> getters and the example prints 'a' and 'b'.
>
> btw, the example seems to work even with old-styl
Ray wrote:
> http://wiki.wxpython.org/index.cgi/FAQ#head-4cc058aed6216dd200d55a6e4c077ccbe82bd142
Here's a trick that embeds the manifest into the executable (which is a
little cleaner) and adds meta info.
1. Add this to the top of your setup.py. Supply your application's name,
version number
Hello,
I'm planning on starting some database work on an Oracle 9i database,
any suggestions on which module I should use.
>From the python.org website I see that the options are:
- DCOracle2
- cx_Oracle
- mxODBC
Any help would be appreciated but please, support your answers somehow.
Thanks
In article <[EMAIL PROTECTED]>, Rony Steelandt wrote:
> Yes, this is on windows using winzip
> It says the zip file is not a valid zipfile
Works fine for me on Windows. Try deleting the file you downloaded,
clearing your browser cache, and trying again.
On the other hand, when you run it it immed
Fredrik Lundh schrieb:
>
> > def foo(x, y=True)
> > def foo(x=True, y)
>
> the latter is a syntax error.
> ...
>
> the defaults array contains the defaults for the len(defaults) last arguments.
And again the own stupidity: I didn't check all my testcases for syntax
errors.
Thanks a lot,
Running FC5 with Gnome (rather minimal install), using latest wxPython
version installed from wxPython.org RPMs since I needed unicode and FC5
only has ansi available in the package manager. Anyway the errors occur
every time i close out of my wxPython application, and sometimes...
maybe every 10 -
Hi,
The following might be documented somewhere, but it hit me unexpectedly
and I couldn't exactly find this in the manual either.
Problem is, that I cannot use augmented assignment operators in a
nested scope, on variables from the outer scope:
PythonWin 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC
I cannot find a Jython newsgroup, so apologies in advance if this
question has been posted to the wrong group.
Just written my first Jython program (previously written Python ones)
and it is working fine in 'interpreted mode'. I now want to compile it
into Java classes but I get the following e
Tim N. van der Leeuw wrote:
> Hi,
>
> The following might be documented somewhere, but it hit me unexpectedly
> and I couldn't exactly find this in the manual either.
>
> Problem is, that I cannot use augmented assignment operators in a
> nested scope, on variables from the outer scope:
> Is
Howdy,
i have the following regex "iface lo[\w\t\n\s]+(?=(iface)|$)"
If "iface" don't follow after the regex "iface lo[\w\t\n\s]" the rest of
the text should be selected.
But ?=(iface) is ignored, it is always the whole texte selected.
What is wrong?
many thanks
greetings
Fabian
--
http://m
Hi,
I wanted a script that can convert any file format (RTF/DOC/HTML/PDF/PS
etc) to text format.
Regards,
Gaurav Agarwal
Fredrik Lundh wrote:
> Marc 'BlackJack' Rintsch wrote:
>
> > What do you mean by 'fileformats'? A script that automagically converts
> > *anything* to text? What about pictu
[EMAIL PROTECTED] wrote:
please stop top-posting, it's getting very annoying
> ya know, I've searched for these "new classes" at least five times.
Then go and buy yourself a pair of glasses. It's one of the entrie in
the "documentation" menu of python.org.
--
bruno desthuilliers
python -c "pri
Pascal Bourguignon wrote:
> [...]
> (coerce (lschar :name "LATIN") 'string)
> --> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
> ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóô
> [...]
In what programming language/interpreter is this code?
--
http://mail.python.org/mailman/li
Hi,
When I use matplotlib for a scatter plot with both dots and connecting lines,
the exported eps file is huge, if the distances between many points are small.
I think of this as a bug, since no preview tiff is included in the generated eps
and a variety of text processing applications (including
I would appreciate it if somebody could tell me where I went wrong in
the following snipet:
When I run I get no result
cnt = 0
p=[]
reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
quotechar="'", delimiter='\t')
for line in reader:
if cnt > 6:
ianaré wrote:
> Running FC5 with Gnome (rather minimal install), using latest wxPython
> version installed from wxPython.org RPMs since I needed unicode and FC5
> only has ansi available in the package manager. Anyway the errors occur
> every time i close out of my wxPython application, and someti
Roman wrote:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
>
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
> quotechar="'", delimiter='\t')
> for line in
Roman wrote:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
>
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
> quotechar="'", delimiter='\t')
> for line i
I hope I am not being too ignorant :p but here goes... my boss has
written a bit of python code and asked me to speed it up for him...
I've reduced the run time from around 20 minutes to 13 (not bad I think
;) to speed it up further I asked him to replace a loop like this:-
index = 0
for element
Roman írta:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
>
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
> quotechar="'", delimiter='\t')
> for line in
On Tue, 04 Jul 2006 07:01:55 -0700, Roman wrote:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
What do you mean? Does it print None?
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="exc
On 2006-07-04, Gaurav Agarwal <[EMAIL PROTECTED]> wrote:
> I wanted a script that can convert any file format (RTF/DOC/HTML/PDF/PS
> etc) to text format.
And I want to win the lottery.
Without having to buy tickets.
--
Grant Edwards grante Yow! You can't hurt
On Tue, 04 Jul 2006 06:32:13 -0700, Gaurav Agarwal wrote:
> Hi,
>
> I wanted a script that can convert any file format (RTF/DOC/HTML/PDF/PS
> etc) to text format.
RTF, HTML and PS are already text format.
DOC is a secret, closed proprietary format. It will be a lot of work
reverse-engineering i
itertools.izip is usually faster than zip. You can try that.
--
http://mail.python.org/mailman/listinfo/python-list
Martin v. Löwis wrote:
> Filipe wrote:
> > output ---
> > u'Fran\xd8a'
> > FranØa
> >
> >
> > What do you think? Might it be Pymssql doing something wrong?
>
> I think the data in your database is
On Tue, 04 Jul 2006 03:06:37 -0700, aliassaf wrote:
>
> Hello,
>
> If we write = x^2 and if I give to the program the values of x, it will
> going to calculate the values of y, and also for x.
>
> But it is possible ? that is if I give to the program the values of X and Y,
> it will indi
Thanks for your help
My intention is to create matrix based on parsed csv file. So, I would
like to have a list of columns (which are also lists).
I have made the following changes and it still doesn't work.
cnt = 0
p=[[], [], [], [], [], [], [], [], [], [], []]
reader = csv.reader(file("f:\we
Roman schrieb:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
>
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
> quotechar="'", delimiter='\t')
> for lin
On Mon, 03 Jul 2006 06:20:36 -0700, Vusi wrote:
> /* $Id: dotquad.c 3529 2005-10-01 10:15:22Z dyoung $ */
> /*
> * Copyright (c) 2003, 2004 David Young. All rights reserved.
> *
> * This code was written by David Young.
[snip code]
Am I the only one who found it hilarious that this piece of
In <[EMAIL PROTECTED]>, Fabian Holler wrote:
> Howdy,
>
>
> i have the following regex "iface lo[\w\t\n\s]+(?=(iface)|$)"
>
> If "iface" don't follow after the regex "iface lo[\w\t\n\s]" the rest of
> the text should be selected.
> But ?=(iface) is ignored, it is always the whole texte selected
Rune Strand wrote:
> itertools.izip is usually faster than zip. You can try that.
Thanks very much
timing for itertools.izip
for av, bv, cv, dv in itertools.izip(a, b, c, d):
avbv = (av-bv) * (av - bv)
diff = cv - dv
e.append(diff - avbv)
on a 4 million element aray:
slice:
8.06299
Roman wrote:
> Thanks for your help
>
> My intention is to create matrix based on parsed csv file. So, I would
> like to have a list of columns (which are also lists).
>
> I have made the following changes and it still doesn't work.
>
>
> cnt = 0
> p=[[], [], [], [], [], [], [], [], [], [], []]
>
simon...
the issue that i'm seeing is not a result of simply using the
'string.replace' function. it appears that there's something else going on
in the text
although i can see the nbsp in the file, the file is manipulated by a number
of other functions prior to me writing the information out
Hi Terry.
I see:
http://codespeak.net/pypy/dist/pypy/doc/news.html
"...by translating RPython to Javascript..."
It isn't an implementation.
--
JavaScript implementation of Python
http://groups.google.it/group/JSython/
Terry Hancock ha scritto:
> . wrote:
>
> > What is the fast way for a fast
> p[j] does not give you a reference to an element inside p. It gives
> you a new sublist containing one element from p. You then append a
> column to that sublist. Then, since you do nothing more with that
> sublist, YOU THROW IT AWAY.
Not correct.
p = [[]]
p[0].append(1)
print p
yields
[[1
Hello Marc,
thank you for your answer.
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, Fabian Holler wrote:
>> i have the following regex "iface lo[\w\t\n\s]+(?=(iface)|$)"
>>
>> If "iface" don't follow after the regex "iface lo[\w\t\n\s]" the rest of
>> the text should be selected.
>
[EMAIL PROTECTED] wrote:
> ## just for a laugh my own zip function
> ## the joke is it runs faster than built in zip ??
since it doesn't do the same thing, it's not a very good joke.
> def myzip(*args):
> index = 0
> for elem in args[0]:
> zipper = []
> for arg in args:
>
On Tue, 04 Jul 2006 07:18:29 -0700, [EMAIL PROTECTED] wrote:
> I hope I am not being too ignorant :p but here goes... my boss has
> written a bit of python code and asked me to speed it up for him...
> I've reduced the run time from around 20 minutes to 13 (not bad I think
> ;) to speed it up furt
> so fastest overall
you may experience speed-ups by using
from itertools import izip
and just use izip() instead to avoid the module namespace lookup. The
same applies for the list.append() methods. If you're appending some
million times
a_list = []
a_list_append = a_list.append
a_list_append
Nothing got printed.
Could you tell me what would be pythonic version of what I am trying to
do?
Diez B. Roggisch wrote:
> > p[j] does not give you a reference to an element inside p. It gives
> > you a new sublist containing one element from p. You then append a
> > column to that sublist. T
Steven D'Aprano wrote:
> On Tue, 04 Jul 2006 07:18:29 -0700, [EMAIL PROTECTED] wrote:
>
> > I hope I am not being too ignorant :p but here goes... my boss has
> > written a bit of python code and asked me to speed it up for him...
> > I've reduced the run time from around 20 minutes to 13 (not bad
Fabian Holler wrote:
> Yes thats right, but that isn't my problem.
> The problem is in the "(?=(iface)|$)" part.
no, the problem is that you're thinking "procedural string matching from
left to right", but that's not how regular expressions work.
> I have i.e. the text:
>
> "auto lo eth0
> ifa
Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
> > ## just for a laugh my own zip function
> > ## the joke is it runs faster than built in zip ??
>
> since it doesn't do the same thing, it's not a very good joke.
>
> > def myzip(*args):
> > index = 0
> > for elem in args[0]:
> >
On Tue, 04 Jul 2006 08:09:53 -0700, bruce wrote:
> simon...
>
> the issue that i'm seeing is not a result of simply using the
> 'string.replace' function. it appears that there's something else going on
> in the text
>
> although i can see the nbsp in the file, the file is manipulated by a n
[EMAIL PROTECTED]:
Using Python you can do:
# Data:
l_a = [1.1, 1.2]
l_b = [2.1, 2.2]
l_c = [3.1, 3.2]
l_d = [5.1, 4.2]
from itertools import izip
l_e = [(c-d) - (a-b)*(a-b) for a,b,c,d in izip(l_a, l_b, l_c, l_d)]
print l_e
With psyco + the standard module array you can probably go quite fast,
Thanks Steven, Actually i wanted a do text processing for my office
where I can view all files in the system and use the first three to
give a summary of the document. Instead of having somebody actually
entering the summary. Seems there is no one code that can act as
convertor across formats, i'll
Hi all,
I have
invested probably 500 hours in the development of a module which I think could
fill a gap, judging by some problems regularly discussed on this
forum. The module is finished and I want to contribute it. A kind
sould recently suggested I upload it to the Cheese Shop. I
Roman wrote:
(please dont top-post - corrected)
>
> Iain King wrote:
>
>>Roman wrote:
>>
>>>I would appreciate it if somebody could tell me where I went wrong in
>>>the following snipet:
>>>
(snip)
>>What are you trying to do here? p[:0] returns a new list, of all the
>>elements in p up to ele
update...
the error i'm getting...
>>>UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in
position 62: ordinal not in range(128)
is there a way i can tell/see what the exact char is at pos(62). i was
assuming that it's the hex \xa0.
i've done the s.replace('\xa0','') with no luc
Hi,
I have the following code for a cline and server which I got from a
small tutorial on the web.
#!/ usr/bin/env python
# tms.py (SERVER)
import socket
import sys
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = ''
port = int(sys.argv[1])
s.bind((host,port))
s.listen(1)
conn, add
steven...
when you have the >>>u'hello ? world'<< in your interpreter/output, is the
'u' indicating that what you're displaying is unicode?
i pretty much tried what you have in the replace.. and i got the same error
regarding the unicodedecode error...
-Original Message-
From: [EMAIL
I'm having problems with sub-classes of built-in types.
Here is a contrived example of my subclass. It isn't supposed
to be practical, useful code, but it illustrates my problem.
class MyStr(str):
"""Just like ordinary strings, except it exhibits special behaviour
for one particular value
[EMAIL PROTECTED] wrote:
> I hope I am not being too ignorant :p but here goes... my boss has
> written a bit of python code and asked me to speed it up for him...
> I've reduced the run time from around 20 minutes to 13 (not bad I think
> ;) to speed it up further I asked him to replace a loop li
[EMAIL PROTECTED] wrote:
> #/ usr/bin/env python
> # filename: tmc.py (CLIENT)
>
> import socket
> import sys
>
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>
> host = int(sys.argv[1])
> port = int(sys.argv[2])
the port number is an integer, but the host name/ip is obviously not an
1 - 100 of 170 matches
Mail list logo