Does anyone know what algorithms for integer multiplication does Python use?
I am trying to compare it to those used by Sage as it seems like it takes
much longer for Python to do large integer multiplication as compared to
Sage (anyone know off the top of their heads?)
thank you
--
http://mail.p
What's the Python function call overhead like?
Eddie Watson
"CLC plonkers in a state of panic!!!"
--
http://mail.python.org/mailman/listinfo/python-list
Luis Zarrabeitia <[EMAIL PROTECTED]> writes:
>I need to parse a file, text file. The format is something like that:
>TYPE1 metadata
>data line 1
>data line 2
>...
>data line N
>TYPE2 metadata
>data line 1
>...
>TYPE3 metadata
>...
>And so on. The type and metadata determine how to parse the fol
tn.write("ls\n")
stdout = tn.read_until(prompt)
for line in stdout.splitlines():
...
etc.
alternatively just send them all in one go as you have been and save the
output in a variable and split that on the prompt. In either case you may
want to change the prompt to something easier to match on like "$hostname# ".
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] writes:
>Hi,
>Hi,
>I am taking a string as an input from the user and it should only
>contain the chars:L , M or R
>I tried the folllowing in kodos but they are still not perfect:
>[^A-K,^N-Q,^S-Z,^0-9]
>[L][M][R]
>[LRM]?L?[LRM]? etc but they do not exactly meet what I need.
s pdt
>>> p = pdt.Calendar()
>>> p.parse('next month')
((2008, 7, 1, 9, 0, 0, 1, 183, -1), 1)
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
$number = reverse $_[0];
>$number =~ s/(\d\d\d)(?=\d)(?!d*\.)/$1,/g;
>return scalar reverse $number;
>}
>But I cannot find how to do this in Python.
Look at the locale module. If you're producing the numbers yourself then they
get printed in that format othe
[EMAIL PROTECTED] writes:
>I'm new to python and I was wondering if there are any intelligent
>date/time parsing modules out there. I've looked at strptime (or
>whichever it is) and mxDateTime from the eGenix package. I need
>something to parse user input for a django app, and it's awesome to be
>
e working for me.
>Is there an easier/better way to debug online scripts? I was hoping
>there might be something similar to php where it gives some error info
>and the line code.
One simple method might be something along these lines:
http://aspn.activestate.com/ASPN/Cookbook/Python/Reci
A moron posting from google?
How unusual!
--
Posted via a free Usenet account from http://www.teranews.com
--
http://mail.python.org/mailman/listinfo/python-list
For PARSING see http://code-bear.com/code/parsedatetime/
The OP was looking for presentation though. I know roundup has code for this
if an independent library can't be found.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
proved beyond
all recognition since I last used it). Try putting together some sample
scripts in both languages and see how easily others can understand them (and
yourself in a few months).
When I want something nimbler than Python I use Lua.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
Paul McGuire <[EMAIL PROTECTED]> writes:
>On Jul 23, 12:43 pm, [EMAIL PROTECTED] (Eddie Corns) wrote:
>> Paul McGuire <[EMAIL PROTECTED]> writes:
>> >On Jul 23, 5:53 am, [EMAIL PROTECTED] (Eddie Corns) wrote:
>> >> Wolfgang Strobl <[EMAIL PROTECTED]&g
Paul McGuire <[EMAIL PROTECTED]> writes:
>On Jul 23, 5:53 am, [EMAIL PROTECTED] (Eddie Corns) wrote:
>> Wolfgang Strobl <[EMAIL PROTECTED]> writes:
>> >few of James Gimple's snippets from "Algorithms in SNOBOL4"
>> >(->http://www.snobol4.
iced them or the PDF of the book there before. Some Friday
afternoon reading for sure.
Personally I hope to get more to time to look at a combination of Lua and
PEGs (http://en.wikipedia.org/wiki/Parsing_expression_grammar) for my parsing
needs.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
he benefit of SNOBOL matching without direct
language support. There's only so much a library can do. However a valiant
and interesting effort:
http://www.wilmott.ca/python/patternmatching.html
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
hances are pretty
>good. ;-)
I can't help noticing that dates in '-mm-dd' format are already sortable
as strings.
>>> '1999-12-30' > '1999-12-29'
True
depending on the pattern of access the slightly slower compare speed _might_
compensate for the conversion speed. Worth a try.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
=?iso-8859-1?q?Pekka_J=E4rvinen?= <[EMAIL PROTECTED]> writes:
>On 20 huhti, 14:34, [EMAIL PROTECTED] (Eddie Corns) wrote:
>> Look at:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/466298
>> it handles most of the logic of combining IP ranges.
>>
>> Eddi
Look at:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/466298
it handles most of the logic of combining IP ranges.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
r to the language.
Worked for me. The 1/e was the easiest intro to a language I've ever read.
(I don't suppose you fancy doing one for Ruby :)
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
cidentally I don't think you could do it in SQL at all in this way but you
could do it in a more vertical fashion (eg
001, red, circle, 11
001, blue, square, 4
002, red, rhombus, 99) etc.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
roduce a security hazard in your app is that only your files are
endangered. I run several TG apps in user space and the only small problem
I've had is the logistics of telling people if you have to move it somewhere
else since a DNS alias doesn't help much with explicit port numbers in the URL.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
constant swapping. Is there a way to look at which objects or
variables are taking the huge amount of memory space?
Thanks,
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
Well if it's any consolation; that's exactly what I did - cut about 7 lines
from CGIHTTPSERVER into my do_POST method. Maybe we're both stoopid. This
was at least 3 years ago before I moved on to Quixote and then
CherryPy/TurboGears but I recall thinking at the time that it wa
Kent Johnson <[EMAIL PROTECTED]> writes:
>Eddie Corns wrote:
>> If I get time I'll try to get this working in Sam Wilmott's Python pattern
>> matching library.
>>
>> What fun!
>Cool! I have to get in on the fun :-)
>This program uses Sa
7; '/' arb $ x arb $ y arb $ z '/' *x *y '/'
+arb $ v *x arb $ w '/' *differ(v) *differ(w) *differ(x)
+*differ(y) *differ(z) *foo(v '/' w '/' x '/' y '/' z) :F(end)
generates:
ee/bcac/a/bca/aab
eeabc/c/a/bca/aab
ee/cac/ab/ca/aab
ee/ac/abc/a/aab
If I get time I'll try to get this working in Sam Wilmott's Python pattern
matching library.
What fun!
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] writes:
>hi
>i am using a telnet session to simulate an authentication mechanism
>USER = "user"
>PASSWORD = "password"
>try:
>telnet = telnetlib.Telnet(HOST)
>telnet.set_debuglevel(5)
>telnet.read_until("login: ")
>telnet.write(USER + "\n")
>
d so easy!. There's also a whole bunch of tools on that
page. Maybe there's an optimiser you can use in one of them.
Failing that I guess you build a tree and try to merge nodes where they fork.
I suspect an optimal solution would be hard but if you knew your input did
have lots of redundancy a simple algorithm might work.
Or I could be talking crap as usual.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
"Jim" <[EMAIL PROTECTED]> writes:
>Eddie Corns wrote:
>> Just a small point - what does "in order" mean here? if it means that eg 1362
>> is not valid then you're stuck because it's context sensitive and hence not
>> regular.
>I
"Fredrik Lundh" <[EMAIL PROTECTED]> writes:
>Eddie Corns wrote:
>> >I want an re that matches strings like "21MAR06 31APR06 1236",
>> >where the last part is day numbers (1-7), i.e it can contain
>> >the numbers 1-7, in order, only one
as thinking of
Just a small point - what does "in order" mean here? if it means that eg 1362
is not valid then you're stuck because it's context sensitive and hence not
regular.
I can't see how any of the fancy extensions could help here but maybe I'm just
lacking insi
lid password) the far end might throw away
any pending input when it finally does send the Password: prompt (otherwise it
would probably have got back in sync).
In short you shouldn't go past each stage unless you've verified that you got
the expected response. I can't actually remember exactly what the responses
signify but at a minimum I assume the empty string means there's no point in
continuing because what you expected to see wasn't there so you need to either
abort or try some recovery process. And also make sure you give it a
reasonable time to respond.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
about it? Have you checked the return value from the
read_until()s to see if they're returning anything sensible? are any of them
timing out?
Anyway, my first guess would be the use of read_very_eager(), it's something
you normally only descend to when you're stuck for something to match on.
Normally you would do another read_until() for the prompt.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
http://numeric.scipy.org/
Eddie
jason wrote:
> Thanks for your response. I'll try to install all the same versions that you
> have.
>
> I have removed my version of Python and installed ActivePython
> (ActivePython-2.4.2.10-win32-x86.msi).
>
> Could you please tell me which ver
a cookbook is misleading, it shows how to do essential
tasks using fairly complete examples.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
might be worth trying to unistall Python and
installing the Activestate version (which includes the Win32 extensions).
Good luck
Eddie
jason wrote:
> Hello:
>
> I installed the following:
>
> python-2.4.2.msi
> pywin32-207.win32-py2.4.exe
> R-2.2.1-win32.exe
> rpy-0.4
.
http://excess.org/urwid/ I've only played with it a little bit but it looks
useful.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
cleaner shortcut.
You could extract the hours,mins,secs part to a DateTimeDelta which supports
float() and just divide that into 86400.0.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
Simon Brunning <[EMAIL PROTECTED]> writes:
>On 9/22/05, Mike Meyer <[EMAIL PROTECTED]> wrote:
>> I've found a fair number of systems/network monitoring tools (things
>> like Big Brother, Big Sister, cricket, etc.) written in Perl. I'm
>> curious if there
to write
your own scripts in Python. This is probably OK for small networks.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
y = year
>ww = week #
>Thanks for any and all help.
>>> import mx.DateTime
>>> d=mx.DateTime.DateTime(1992)+mx.DateTime.RelativeDateTime(weeks=15)
>>> d
>>> d=mx.DateTime.DateTime(1992)+mx.DateTime.RelativeDateTime(weeks=51)
>>> d
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] writes:
>Hey there.
>i have a time string (created with strftime) then read from a file,
>i am having some trouble understanding how to get the difference
>between times.
>i know i can structime(timestring) and get a time value, but i dont
>know how to manipulate it.
>basically,
'active'?
I'm just basing this on reading telnetlib.py.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
useful but whether it rocks your boat
interest wise ... Admittedly I personally would like to play with Erlang
rather than Python for this.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
ay that it is not sorted in any way
>- shuffle corpus.uniq > corpus.uniq.shuffled
>Unfortunately, none of the machines that I may use has 80G RAM.
>So, using a dictionary will not help.
>Any ideas?
Instead of shuffling the file itself maybe you could index it (with dbm for
insta
while True:
# get one more line
line = tn.read_until ('\n')
regex_thing (line)
Remember, "tail -f" never exits, so you probably want to break when you've
find what you want and then just close the telnet session. It would probably
be nice if telnetlib had a readline function that handled all the messy
details for portable end of line checking.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
might do most of what you want.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
file that either doesn't
exist on the system you are restoring to or not from the directory where you
now are.
I hope that makes sense.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
selected_node = document.getElementById(id);
selected_id = id;
}
function set_visibility_all (n, vis) {
if (n == null) return false;
if (n.nodeType == 1) {
if (n.tagName == "DIV" && n.id != "")
set_visibility (n.id, n, vis);
for (var c = n.firstChild; c != null; c = c.nextSibling)
set_visibility_all (c, vis);
}
}
---
the javascript code is extracted from a larger set of functions that include a
popup menu with inbuilt search (which opens tree levels as necessary), if
you're interested.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
Sorry, I’ve tried to search the web on this,
but I’m still a little fuzzy. I was hoping a quick e-mail might clear
this up.
What I’m looking for, is a way to turn a python ‘application’,
into a ‘stand-alone’ application. i.e., you don’t need the
Python interpreter, libraries, etc, install
sorting on
individual fields rather than whole lines. In which case I would think of
doing a line.split(';') on each line before sorting. It would still need
either to use a function to make empty fields go later or alternatively use
DSU (google!) and convert '' to say '~' and back again. This also solves the
problem of what to expect when only some of the fields are blank rather than
all of them.
Eddie
--
http://mail.python.org/mailman/listinfo/python-list
51 matches
Mail list logo