Re: len()

2009-01-31 Thread Andreas Waldenburger
On Sat, 31 Jan 2009 13:27:02 -0500 Pat p...@junk.net wrote: Tobiah wrote: Just out of curiosity, why was len() made to be it's own function? I often find myself typing things like my_list.len before I catch myself. Thanks, Toby I'm surprised that no one responded to that

Re: is python Object oriented??

2009-01-31 Thread Andreas Waldenburger
On Sat, 31 Jan 2009 09:11:03 +0100 Laszlo Nagy gand...@shopzeus.com wrote: Python is not a pure object oriented language, because it has other programming tools, for example functions. I'm not sure about the first part of the sentence, but Python's functions are objects. Check it in the

[issue5113] 2.5.4.3 / test_posix failing on HPUX systems

2009-01-30 Thread Andreas Kupries
New submission from Andreas Kupries andre...@activestate.com: The 'test_posix' of Python's 2.5.4.3 testsuite fails on HPUX. This has happened on parisc and ia64 systems. On the parisc system failure occurs for both parisc1.1 and parisc2.0w builds. The HPUX versions are 11.00 (parisc) and 11.22

[issue5114] 2.5.4.3 / test_threading hangs

2009-01-30 Thread Andreas Kupries
New submission from Andreas Kupries andre...@activestate.com: On two machines I have seen test_threading hang in ... HPUX 11.22 ia64, Solaris 5.8 sparc The attached file contains the output of running ./apy/bin/python2.5 ./apy/lib/python2.5/test/regrtest.py -v test_threading

RE: is there a shorter way to write this

2009-01-29 Thread Andreas Tawn
I had a task in a book to pick 5 items from a list of 26 ensuring the items are not repeated import random list = ['a','b','c','d','e','f','g','h','i','j','k','l','m', 'n','o','p','q','r','s','t','u','v','w','x','y','z'] word = ' ' a = random.choice(list) list.remove(a) b =

Re: Counting number of objects

2009-01-26 Thread Andreas Waldenburger
On Mon, 26 Jan 2009 02:37:37 + Mark Wooding m...@distorted.org.uk wrote: This looks OK, although I'd suggest using cls.counter += 1 instead of a.counter += 1 in the __new__() method. Just seems clearer to me, esp. when you think about subclassing. I'm not sure about clarity, but

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Andreas Waldenburger
On 26 Jan 2009 14:51:33 GMT Marc 'BlackJack' Rintsch bj_...@gmx.net wrote: On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote: content = a.readlines() (Just because we can now write for line in file doesn't mean that readlines() is *totally* redundant.) But ``content =

Re: Method returning an Iterable Object

2009-01-26 Thread Andreas Waldenburger
On Mon, 26 Jan 2009 22:01:21 +0530 Anjanesh Lekshminarayanan m...@anjanesh.net wrote: Is there a way to return an iterable object ? class twoTimes: def __init__(self, n): self.__n = n def getNext(): self.__n *= 2 return self.__n Rename getNext() to

Re: Method returning an Iterable Object

2009-01-26 Thread Andreas Waldenburger
On Tue, 27 Jan 2009 00:05:53 +0530 Anjanesh Lekshminarayanan m...@anjanesh.net wrote: You can also replace the whole class with a function thusly: def two_times(n): for k in itertools.count(1): yield n * (2**k) This function is then called a generator (because

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Andreas Waldenburger
On 26 Jan 2009 22:12:43 GMT Marc 'BlackJack' Rintsch bj_...@gmx.net wrote: On Mon, 26 Jan 2009 16:10:11 +0100, Andreas Waldenburger wrote: On 26 Jan 2009 14:51:33 GMT Marc 'BlackJack' Rintsch bj_...@gmx.net wrote: On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote

Re: Counting number of objects

2009-01-25 Thread Andreas Waldenburger
On Sun, 25 Jan 2009 09:23:35 -0800 (PST) Kottiyath n.kottiy...@gmail.com wrote: Hi, I am creating a class called people - subclasses men, women, children etc. I want to count the number of people at any time. So, I created code like the following: class a(object): counter = 0

Re: v = json.loads({'test':'test'})

2009-01-25 Thread Andreas Waldenburger
On Sun, 25 Jan 2009 23:51:41 +0100 Diez B. Roggisch de...@nospam.web.de wrote: gert schrieb: {'test': 'test'} {test: test} It can not be that hard to support both notation can it ? It's not hard, but it's not standard-conform. OK, playing the devil's advocate here: Doesn't

Re: v = json.loads({'test':'test'})

2009-01-25 Thread Andreas Waldenburger
On Sun, 25 Jan 2009 19:04:44 -0500 Steve Holden st...@holdenweb.com wrote: Andreas Waldenburger wrote: On Sun, 25 Jan 2009 23:51:41 +0100 Diez B. Roggisch de...@nospam.web.de wrote: gert schrieb: {'test': 'test'} {test: test} It can not be that hard to support both notation can

Re: I'm a python addict !

2009-01-25 Thread Andreas Waldenburger
On Sat, 24 Jan 2009 23:53:17 + MRAB goo...@mrabarnett.plus.com wrote: Terry Reedy wrote: For a Python 'program', see http://xkcd.com/534/ It doesn't follow PEP 8! So Randall can just forget about getting xkcd in the Standard Library. Let this be an example to all of you­! /W -- My

[issue4949] Constness in PyErr_NewException

2009-01-14 Thread Andreas Kloeckner
New submission from Andreas Kloeckner inf...@tiker.net: The name argument to PyErr_NewException() should be changed from char * to const char *. Since the rest of pyerrors.h is const-correct, this seems like an omission. -- components: Interpreter Core messages: 79868 nosy: inducer

Re: Why not Ruby?

2009-01-02 Thread Andreas Waldenburger
On 02 Jan 2009 12:45:36 GMT Steven D'Aprano st...@remove-this-cybersource.com.au wrote: You've just earned a plonking for the next month. Do try to have at least half a clue by February. I will state again that there seems to have been a slight change of tone in clp lately. How about we

Re: Is there a better algorithm?

2009-01-02 Thread Andreas Waldenburger
On Fri, 02 Jan 2009 19:55:43 +0100 Markus Brueckner n...@slash-me.net wrote: g = ( ((e[0],None,e[1]) if len(e)==2 else (e[0],e[1],e[2])) for e in L) If this isn't proof of Python's versatility, I don't know what is. In one line it can mimic both Lisp and Perl. Sweet. :) /W -- My real email

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Andreas Waldenburger
On Fri, 2 Jan 2009 14:36:04 -0800 (PST) vk vmi...@gmail.com wrote: There needs to be a user_io or sanitize module in the standard library to take care of this stuff. [snip example] Great idea! +1 ... but there isn't, as far as I know. Well, get to it, then. ;) /W -- My real email

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Andreas Waldenburger
On Fri, 2 Jan 2009 16:16:10 -0800 (PST) vk vmi...@gmail.com wrote: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase names outta there :-) haha, please forgive me. I'll try and think of some more creative names. FYI: The names themselves aren't he problem

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Andreas Waldenburger
On Fri, 2 Jan 2009 16:44:11 -0800 (PST) r rt8...@gmail.com wrote: On Jan 2, 6:26 pm, Andreas Waldenburger geekm...@usenot.de wrote: On Fri, 2 Jan 2009 16:16:10 -0800 (PST) vk vmi...@gmail.com wrote: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase

Re: execution time

2008-12-14 Thread Andreas Kostyrka
execution time for bucket2.sort(data) ? Well: import time starttime = time.time() endtime = time.time() print Whatever does, it took %5.3fs to do. % (endtime - starttime) Alternativly take a look at the timeit standard module. Andreas Thanks in advance! -- http

Re: Python is slow

2008-12-14 Thread Andreas Kostyrka
. But you sometime need a developer that can wield the tool with a certain experience, and not a stupid rookie that whines that his tool does not make his O(n**n) algorithm automatically blazing fast. Andreas By the way... I know of a very slow Python site called YouTube.com. In fact

Re: Python is slow

2008-12-12 Thread Andreas Kostyrka
the time that it was announced that Parrot will have a Python frontend. Andreas -- http://mail.python.org/mailman/listinfo/python-list

Re: looking up function's doc in emacs

2008-12-11 Thread Andreas Röhler
Xah Lee wrote: in programing elisp in emacs, i can press “Ctrl+h f” to lookup the doc for the function under cursor. is there such facility when coding in perl, python, php? (i'm interested in particular python. In perl, i can work around with “perldoc -f functionName”, and in php it's

Re: Mathematica 7 compares to other languages

2008-12-11 Thread Andreas Waldenburger
On Thu, 11 Dec 2008 05:40:45 + Paul Rudin [EMAIL PROTECTED] wrote: Dotan Cohen [EMAIL PROTECTED] writes: 2008/12/10 [EMAIL PROTECTED]: Ruby: def norm a s = Math.sqrt(a.map{|x|x*x}.inject{|x,y|x+y}) a.map{|x| x/s} end If someone doesn't counter with a Python one-liner

Re: Is 3.0 worth breaking backward compatibility?

2008-12-11 Thread Andreas Waldenburger
On Thu, 11 Dec 2008 10:21:55 -0800 (PST) walterbyrd walterb...@iname.com wrote: On Dec 7, 12:35 pm, Andreas Waldenburger geekm...@usenot.de wrote: Plze. Python 3 is shipping now, and so is 2.x, where x 5. Python 2 is going to be around for quite some time. What is everybody's

Re: Guido's new method definition idea

2008-12-07 Thread Andreas Waldenburger
On Sun, 07 Dec 2008 02:49:27 -0500 acerimusdux [EMAIL PROTECTED] wrote: I'm not sure though whether allowing both syntaxes would make things more or less confusing. It might actually be helpful in some respects for newcomers to realize that self.method(arg) is somewhat the same as

Re: Guido's new method definition idea

2008-12-07 Thread Andreas Waldenburger
On Sat, 6 Dec 2008 23:21:04 -0800 (PST) Lie [EMAIL PROTECTED] wrote: I think we have to test this on newbies. [snip] Now that's talking like a programmer! Ideas on how such a survey could be conducted? Anyone? If this dead horse is revived because of that reason, then I'd go with changing

Re: Guido's new method definition idea

2008-12-07 Thread Andreas Waldenburger
On Sun, 07 Dec 2008 19:13:18 +0100 Bruno Desthuilliers [EMAIL PROTECTED] wrote: and friendlier to newbies. I'd rather say more acceptable to java-brainwashed developpers. Why would you rather be unfriendly and seed ambivalence? I do see the fun in a little Python snobbism, but ... come on.

Importing the re module fails

2008-12-07 Thread Andreas Waldenburger
This is a little puzzling. Using ipython: [EMAIL PROTECTED] Logstuff]$ ipython Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) Type copyright, credits or license for more information. [snip ipython help message] In [1]: import re This works fine. But with the

Re: Is 3.0 worth breaking backward compatibility?

2008-12-07 Thread Andreas Waldenburger
On Sun, 7 Dec 2008 11:22:23 -0800 (PST) walterbyrd [EMAIL PROTECTED] wrote: IMO: breaking backward compatibility is a big deal, and should only be done when it is seriously needed. Plze. Python 3 is shipping now, and so is 2.x, where x 5. Python 2 is going to be around for quite some

Re: Is 3.0 worth breaking backward compatibility?

2008-12-07 Thread Andreas Waldenburger
On Sun, 7 Dec 2008 20:35:53 +0100 Andreas Waldenburger [EMAIL PROTECTED] wrote: On Sun, 7 Dec 2008 11:22:23 -0800 (PST) walterbyrd [EMAIL PROTECTED] wrote: At best, I am a casual python user, so it's likely that I am missing something. Yes, the big picture. OK, that was a bit harsh. I

Re: Importing the re module fails

2008-12-07 Thread Andreas Waldenburger
On Sun, 07 Dec 2008 20:36:58 +0100 Diez B. Roggisch [EMAIL PROTECTED] wrote: Andreas Waldenburger schrieb: This is a little puzzling. Using ipython: [EMAIL PROTECTED] Logstuff]$ ipython Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) Type copyright, credits

[OT] [sort of] Malcom Reynolds?

2008-12-07 Thread Andreas Waldenburger
Just found this in the re module's docs: m = re.match(r(?Pfirst_name\w+) (?Plast_name\w+), Malcom Reynolds) Does this represent an attempt to phase out the gratuitous Monty Python references in favor of gratuitous Firefly references? Because if so, I'm all for it. Anyways, stuff like

Re: Python for kids?

2008-12-07 Thread Andreas Waldenburger
On Sun, 7 Dec 2008 12:13:37 -0800 (PST) Russ P. [EMAIL PROTECTED] wrote: I have a 12-year-old son who spends too much time playing Xbox live and watching silly YouTube videos. I would like to try to get him interested in programming. Is anyone aware of a good book or website that addresses

Re: Guido's new method definition idea

2008-12-07 Thread Andreas Waldenburger
On Sun, 07 Dec 2008 20:56:40 GMT I V [EMAIL PROTECTED] wrote: So, if we want Python to the programming language of choice for Lacanian psychoanalysts, perhaps we should adopt the symbol $ (or even, with Python 3's support for unicode identifiers, S followed by U+0388) instead of self. OK, I'm

Re: Don't you just love writing this sort of thing :)

2008-12-06 Thread Andreas Waldenburger
On Sat, 06 Dec 2008 20:28:17 +1300 Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: Does that make any sense to you, or should I start drawing simple diagrams? People, please! Is some civility too much to ask? /W -- My real email address is constructed by swapping the domain with the recipient

Re: Guido's new method definition idea

2008-12-06 Thread Andreas Waldenburger
On 6 Dec 2008 09:18:20 GMT Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sat, 06 Dec 2008 09:56:12 +0100, Antoine De Groote wrote: [snip reference to preferably only one way to do it] The reason why I'm against that change too. It adds a second, alternative way to express

Re: Guido's new method definition idea

2008-12-06 Thread Andreas Waldenburger
On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] wrote: class C: def $method(arg): $value = arg (Note there's no point after $, it's not currently possible). Ruby uses @ and @@ for similar purposes. I agree that the code looks worse, but also shorter to read and

Re: Guido's new method definition idea

2008-12-06 Thread Andreas Waldenburger
On Sat, 6 Dec 2008 13:32:58 +0100 Andreas Waldenburger [EMAIL PROTECTED] wrote: On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] suggested: class C: def $method(arg): $value = arg [snip] [snip] self is a speaking identifier, $ isn't. Also, nothing

Re: Guido's new method definition idea

2008-12-06 Thread Andreas Waldenburger
On Sat, 6 Dec 2008 14:39:34 -0800 (PST) Russ P. [EMAIL PROTECTED] wrote: I don't know much about Perl, but my understanding is that a dollar sign must be used every time a variable is dereferenced, as in bash or other shell languages. What we are proposing here is something entirely

Re: as keyword woes

2008-12-05 Thread Andreas Waldenburger
On 04 Dec 2008 22:29:41 GMT Steven D'Aprano [EMAIL PROTECTED] wrote: Thank goodness we don't have to program in verbose, explicit English! Then you'll HATE Inform 7: http://en.wikipedia.org/wiki/Inform_7#Example_game_2 :) /W -- My real email address is constructed by swapping the domain with

Re: RELEASED Python 3.0 final

2008-12-05 Thread Andreas Waldenburger
On Thu, 4 Dec 2008 15:49:46 -0600 [EMAIL PROTECTED] wrote: Andreas Whenever has it been a pythonic ideal to not allow Andreas stuff? You get warnings. Everything else is up to you. It's more than warnings. With properly crafted combinations of spaces and tabs you can get code

Re: To Troll or Not To Troll (aka: as keyword woes)

2008-12-05 Thread Andreas Waldenburger
On Thu, 4 Dec 2008 16:17:20 -0800 Warren DeLano [EMAIL PROTECTED] wrote: Thank so much for the suggestions Ben. Sorry that I am personally unable to live up to your high standards, but it is nevertheless an honor to partipicate in such a helpful and mutually respectful community mailing

Whitespace in Python (3) [was: RELEASED Python 3.0 final]

2008-12-05 Thread Andreas Waldenburger
On Fri, 5 Dec 2008 07:46:02 -0800 (PST) [EMAIL PROTECTED] wrote: Andreas Waldenburger: My point is: If you mix tabs and spaces in a way that breaks code, you'll find out pretty easily, because your program will not work. - Most newbies don't know that. - Sometimes it may produce wrong

Re: RELEASED Python 3.0 final

2008-12-05 Thread Andreas Waldenburger
On Fri, 5 Dec 2008 12:16:47 -0800 (PST) Fernando H. Sanches [EMAIL PROTECTED] wrote: On Dec 4, 5:45 pm, Andreas Waldenburger [EMAIL PROTECTED] wrote: On Thu, 4 Dec 2008 11:52:38 -0600 [EMAIL PROTECTED] wrote: [snip] Whenever has it been a pythonic ideal to not allow stuff? You get

[issue4551] The python 2.6.1 source distribution is missing Doc/tools/sphinxext

2008-12-05 Thread Andreas Kupries
New submission from Andreas Kupries [EMAIL PROTECTED]: The directory Doc/tools/sphinxext is missing in the Python 2.6.1 source distribution. This breaks building the html help. The directory is present in the Python 2.6 source distribution. -- components: Installation messages: 77061

Re: Mathematica 7 compares to other languages

2008-12-04 Thread Andreas Waldenburger
On Wed, 03 Dec 2008 20:38:44 -0500 Lew [EMAIL PROTECTED] wrote: Xah Lee wrote: enough babble ... Good point. Plonk. Guun dun! I vaguely remember you plonking the guy before. Did you unplonk him in the meantime? Or was that just a figure of speech? teasingly yours, /W -- My real

Re: Please fix your clock [was Re: Multiple equates]

2008-12-04 Thread Andreas Waldenburger
On 04 Dec 2008 15:53:21 GMT Steven D'Aprano [EMAIL PROTECTED] wrote: Hendrik, I think your PC's clock is wrong. You seem to be posting from the future. So? Maybe he is. What's your problem? /W -- My real email address is constructed by swapping the domain with the recipient (local part).

Re: Please fix your clock [was Re: Multiple equates]

2008-12-04 Thread Andreas Waldenburger
On Thu, 4 Dec 2008 06:40:02 +0200 Hendrik van Rooyen [EMAIL PROTECTED] wrote: Andreas Waldenburger [EMAIL PROTECTED] On 04 Dec 2008 15:53:21 GMT Steven D'Aprano [EMAIL PROTECTED] wrote: Hendrik, I think your PC's clock is wrong. You seem to be posting from the future. So

Re: as keyword woes

2008-12-04 Thread Andreas Waldenburger
On Thu, 4 Dec 2008 10:44:33 -0600 Chris Mellon [EMAIL PROTECTED] wrote: Aside from the cultural indoctrination, though (and that may be a real and strong force when dealing with math software, and I don't want to discount it in general, just for purposes of this discussion) why is it more

Re: RELEASED Python 3.0 final

2008-12-04 Thread Andreas Waldenburger
On Thu, 4 Dec 2008 09:30:52 -0800 Daniel Fetchinson [EMAIL PROTECTED] wrote: As you have probably guessed: nothing changed here. Also see:http://www.python.org/dev/peps/pep-0666/ What? Do you mean it's possible to mix tabs and spaces still? Why? Why not? +1 -- My real email

Re: RELEASED Python 3.0 final

2008-12-04 Thread Andreas Waldenburger
On Thu, 4 Dec 2008 11:52:38 -0600 [EMAIL PROTECTED] wrote: As you have probably guessed: nothing changed here. Also see:http://www.python.org/dev/peps/pep-0666/ What? Do you mean it's possible to mix tabs and spaces still? Why? Daniel Why not? Because it

Re: Reverse zip() ?

2008-12-03 Thread Andreas Waldenburger
On Tue, 02 Dec 2008 18:16:13 -0800 Bryan Olson [EMAIL PROTECTED] wrote: zip as its own inverse might be even easier to comprehend if we call zip by its more traditional name, transpose. Sounds like a Py4k change to me. /W -- My real email address is constructed by swapping the domain with

Re: Reverse zip() ?

2008-12-03 Thread Andreas Waldenburger
On Wed, 3 Dec 2008 02:11:51 -0800 (PST) alex23 [EMAIL PROTECTED] wrote: On Dec 3, 6:51 pm, Andreas Waldenburger [EMAIL PROTECTED] wrote: On Tue, 02 Dec 2008 18:16:13 -0800 Bryan Olson zip as its own inverse might be even easier to comprehend if we call zip by its more traditional name

Re: Reverse zip() ?

2008-12-03 Thread Andreas Waldenburger
On Wed, 3 Dec 2008 07:08:52 -0800 (PST) Janto Dreijer [EMAIL PROTECTED] wrote: I'd like to point out that since your where thinking in terms of matplotlib, you might actually find numpy's own transpose useful, instead of using zip(*seq) :) This was, of course, to be expected. :) Whenever

Reverse zip() ?

2008-12-02 Thread Andreas Waldenburger
Hi all, we all know about the zip builtin that combines several iterables into a list of tuples. I often find myself doing the reverse, splitting a list of tuples into several lists, each corresponding to a certain element of each tuple (e.g. matplotlib/pyplot needs those, rather than lists of

Re: Reverse zip() ?

2008-12-02 Thread Andreas Waldenburger
On Tue, 02 Dec 2008 21:12:19 +0100 Stefan Behnel [EMAIL PROTECTED] wrote: Andreas Waldenburger wrote: [snip] This is of course trivial to do via iteration or listcomps, BUT, I was wondering if there is a function I don't know about that does this nicely? I think you're asking about zip

Re: special editor support for indentation needed.

2008-11-27 Thread Andreas Roehler
Eric S. Johansson wrote: Andreas Roehler wrote: with python-mode.el from http://sourceforge.net/projects/python-mode/ I think there's something wrong with the site because it tells me it's version 1.0 from year 2005. You are right, sorry. I should tell you the present place. Barry Warsaw

Re: special editor support for indentation needed.

2008-11-21 Thread Andreas Roehler
Eric S. Johansson wrote: Andreas Roehler wrote: IMO Jeremiah Dodds is right. With all the time spent on this discussion, you could write the needed function in elisp probably. BTW your request seems reasonable. Other python programmers may use it too. I tried learning lisp about 15 years

Re: special editor support for indentation needed.

2008-11-17 Thread Andreas Roehler
seems reasonable. Other python programmers may use it too. Whats Emacs? To an important extent, it's that, you want it to be. So if you have your code, your functions, why it shouldn't it be a long term win? Anyway you should tell, which python-mode and which Emacs you use if any. Andreas

[issue1982] Feature: extend strftime to accept milliseconds

2008-11-17 Thread Andreas Balogh
Andreas Balogh [EMAIL PROTECTED] added the comment: Yes, microsecond support is fine. Elaborating on my initial comment. The following should assert: a_datetime = datetime.now() a_datetime.replace(microsecond = 1) iso_str = adatetime.isoformat() b_datetime = datetime.strptime(iso_str, %Y%m%dT

[issue1982] Feature: extend strftime to accept milliseconds

2008-11-17 Thread Andreas Balogh
Andreas Balogh [EMAIL PROTECTED] added the comment: Some typos corrected. Sorry for any inconvenience. a_datetime = datetime.now() a_datetime.replace(microsecond = 1) iso_str = a_datetime.isoformat() b_datetime = datetime.strptime(iso_str, %Y-%m-%dT%H:%M:%S.%f) assert(a_datetime = b_datetime

Find in list of objects

2008-10-23 Thread Andreas Müller
Hi! (Python 2.2.3 if this is relevant :-) I have a list of objects with, lets say, the attributes ID, x and y. Now I want to find the index of list element with ID=10. Of course I can loop through the list manually, but is there a construct like list.find (10, key='ID') ? Thanks for your

RE: Kicking off a python script using Windows Scheduled Task

2008-10-15 Thread Andreas Tawn
Does anyone know how to properly kick off a script using Windows Scheduled Task? The script calls other python modules within itself. HERE'S THE CATCH: I am used to running the script directly from the command window and the print() is very handy for us to debug and monitor. When running the

RE: Extracting hte font name from a TrueType font file

2008-09-18 Thread Andreas Tawn
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] g] On Behalf Of Steve Holden Sent: Thursday, September 18, 2008 5:59 PM To: python-list@python.org Subject: Extracting hte font name from a TrueType font file Does anyone have a Python recipe for this?

[issue3828] Bound methods compare 'successfully' with ints

2008-09-10 Thread Andreas Kloeckner
New submission from Andreas Kloeckner [EMAIL PROTECTED]: Check out this transcript: 8 --- Python 2.5.2 (r252:60911, Aug 8 2008, 09:22:44) [GCC 4.3.1] on linux2 Type help, copyright, credits or license for more information

String/Number Conversion

2008-09-06 Thread Andreas Hofmann
Hello Folks! I've got a little problem here, which which really creeps me out at the moment. I've got some strings, which only contain numbers plus eventually one character as si-postfix (k for kilo, m for mega, g for giga). I'm trying to convert those strings to integers, with this function:

Re: String/Number Conversion

2008-09-06 Thread Andreas Hofmann
Thanks a lot, I got it working now. Thanks also to the other guys, your numerous hints were really valuable! Kind regards, Andy John Machin schrieb: On Sep 7, 7:04 am, Andreas Hofmann [EMAIL PROTECTED] wrote: Hello Folks! I've got a little problem here, which which really creeps me out

RE: Unable to lookup keys in dictionary

2008-08-12 Thread Andreas Tawn
I am trying to run p4python API on top of python 2.5.2 and am extracting a dictionary from perforce. The following code returns the output that follows it: from P4 import P4, P4Exception p4 = P4() p4.port = erased #deleted p4.user =

sip.so: undefined symbol: PyUnicodeUCS4_AsWideChar

2008-08-04 Thread Andreas Hinzmann
-3.17.4 QScintilla-1.71-gpl-1.7.1 I have also tried to configure python with --enable-unicode=ucs4, but it didn't help. Does anybody have an idea, what is the problem? Is it a conflict between different versions? Thank you in advance, Andreas -- http://mail.python.org/mailman/listinfo

RE: isPrime works but UnBoundLocalError when mapping on list

2008-07-16 Thread Andreas Tawn
Terry Reedy wrote: Wrong. Thank you. For loop variables continue after the loop exits. This is intentional. I never knew that and I can't find reference to it in the docs. Can you help me with the reasons for it? Drea -- http://mail.python.org/mailman/listinfo/python-list

RE: isPrime works but UnBoundLocalError when mapping on list

2008-07-16 Thread Andreas Tawn
Andreas Tawn wrote: Terry Reedy wrote: Wrong. Thank you. For loop variables continue after the loop exits. This is intentional. I never knew that and I can't find reference to it in the docs. Interesting starting point. It never occurred to me that they might not. (So I

RE: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread Andreas Tawn
defn noob wrote: isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it work though but why do I have to add it? Is there a cleaner way to do it? def isPrime(nbr): for x in range(2, nbr + 1): if nbr % x == 0: break

RE: boolian logic

2008-06-13 Thread Andreas Tawn
if a != b and a != c and a != d: doStuff() else: doOtherStuff() Cheers, Drea HI all, I'm a bit stuck with how to work out boolian logic. I'd like to say if A is not equal to B, C or D: do something. I've tried if not var == A or B or C: and various permutations but can't

Overloading __getitem__

2008-05-22 Thread Andreas Matthias
foo['a'] print foo['a', crazy = True] Is it somehow possible to overload __getitem__ with an additional argument? Are there other possibilities to achiev this? Or is the only solution to this to write a normal function call `def my_get (self, key, crazy=False)'? Ciao Andreas -- http

Re: Overloading __getitem__

2008-05-22 Thread Andreas Matthias
__getitem__(*args): Apparently, args already is a tuple, so this should be: def __getitem__(self, args): Is this documented somewhere? I couldn't find it anywhere. Thanks. Ciao Andreas -- http://mail.python.org/mailman/listinfo/python-list

RE: file open/read/name etc, not working

2008-05-15 Thread Andreas Tawn
import os print os.path.exists('C:/Python25/myPrograms/netflix/test.txt') d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r') d.readline() returns true in the shell but prints no text even though the document contains text. d.name returns nothing, d.name() raises an error. --

RE: exists=false, but no complaint when i open it!?

2008-05-15 Thread Andreas Tawn
print os.path.exists('C:\Users\saftarn\Desktop\NetFlixDataSet \training_set') returns False... i have thourogly checked the filename to be correct and if we assume it is what could this mean then? i had a problem one other time when i had renamed a file but windows didnt rename it compeltely

Tremendous slowdown due to garbage collection

2008-04-12 Thread andreas . eisele
. Thanks a lot for your consideration, and best regards, Andreas -- Dr. Andreas Eisele,Senior Researcher DFKI GmbH, Language Technology Lab, [EMAIL PROTECTED] Saarland UniversityComputational Linguistics Stuhlsatzenhausweg 3 tel: +49-681-302-5285 D-66123 Saarbrücken

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread andreas . eisele
; it has lots of highly fine-tuned complicated stuff behind the scenes, that is just doing the right thing, so I should not have to (and I could not) re-invent this myself. Thanks for the helpful comments, Andreas -- http://mail.python.org/mailman/listinfo/python-list

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread andreas . eisele
Sorry, I have to correct my last posting again: Disabling the gc may not be a good idea in a real application; I suggest you to play with the gc.set_threshold function and set larger values, at least while building the dictionary. (700, 1000, 10) seems to yield good results. python2.5

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread andreas . eisele
be faster and it will definitely use much less memory - and memory Python 2.5 and older will never release again. I'm going to fix the issue for Python 2.6 and 3.0. Thanks for this hint, and for the work on the newer versions. This is very much appreciated. Andreas -- http://mail.python.org

[issue2607] why is (default)dict so slow on tuples???

2008-04-11 Thread Andreas Eisele
Andreas Eisele [EMAIL PROTECTED] added the comment: Great, that really solves my problem. Thank you so much, Amaury! As you say, the problem is unrelated to dicts, and I observe it also when including the tuples to a set or keeping them in lists. Perhaps your GC thresholds would be better

[issue2607] why is (default)dict so slow on tuples???

2008-04-11 Thread Andreas Eisele
Andreas Eisele [EMAIL PROTECTED] added the comment: Even if they mean that creation of a huge number N of objects requires O(N*N) effort? __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2607

[issue2607] why is (default)dict so slow on tuples???

2008-04-10 Thread Andreas Eisele
Andreas Eisele [EMAIL PROTECTED] added the comment: Sorry for not giving a good example in the first place. The problem seems to appear only in the presence of sufficiently many distinct tuples. Then I see performance that looks rather like O(n*n) Here is an example that shows the problem

RE: First Program Bug (Newbie)

2008-03-19 Thread Andreas Tawn
[snip] What is the square root function in python? There's one in the math module. Use the one in gmpy if you have it. Or raise to the power 1/power 9**(1.0/2) 3.0 Also works for cube root, quad root etc. 27**(1.0/3) 3.0 81**(1.0/4) 3.0 243**(1.0/5) 3.0 Cheers, Drea --

RE: Web site for comparing languages syntax

2008-02-26 Thread Andreas Tawn
Sebastian Bassi wrote: I know there is one site with wikimedia software installed, that is made for comparing the syntax of several computer languages (Python included). But don't remember the URL. Anyone knows this site? http://99-bottles-of-beer.net/ is one such site, though I don't know

Re: Linux/Python Issues

2008-02-22 Thread Frithiof Andreas Jensen
Bruno Desthuilliers [EMAIL PROTECTED] skrev i en meddelelse news:[EMAIL PROTECTED] [EMAIL PROTECTED] a écrit : So, here's the basic scheme: - download the source tarball, preferably in /usr/local/src - unpack it - cd into the unpacked source directory - *carefully* read the README,

Time conversion between UTC and local time

2008-02-08 Thread andreas . profous
Hi all, I have the following problem: There are strings describing a UTC time, e.g. 2008-01-15 22:32:30 and a string reflecting the time zone e.g. -05:00. What is an elegant way of getting the local time (considering DST - daylight saving time) with that data? The date is not important, just

[issue1982] Feature: extend strftime to accept milliseconds

2008-01-31 Thread Andreas Balogh
New submission from Andreas Balogh: Currently serializing datetime objects into isoformat string is well possible. The reverse process - parsing an isoformat string into a datetime object - doesn't work due to the missing %-tag for the strftime format string. Proposal: Add new tag to strftime

RE: Encryption Recommendation

2008-01-28 Thread Andreas Tawn
I'm still using Python 2.4. In my code, I want to encrypt a password and at another point decrypt it. What is the standard way of doing encryption in python? Is it the Pycrypto module? Usually, one doesn't store clear-text passwords. Instead, use a hash-algorithm like md5 or crypt (the

RE: Hexadecimal list conversion

2007-12-20 Thread Andreas Tawn
Hi All. I have a list which is a line from a file: ['\x003\x008\x001\x004\x007\x005\x00.\x005\x000\x002\x005\x009 \x009\x00', '\x002\x001\x003\x006\x002\x002\x00.\x001\x007\x004\x002\x008\ x002\x00'] This should be in the format: ['381475.502599', '213622.174282'] I've tried a few

Deploying embedded Python

2007-12-17 Thread Andreas Raab
exactly the startup works? What is being read/loaded in which order etc? 3) General advice about deploying embedded Python. Pointers to web sites, general experience (good or bad) etc. are all very welcome. Thanks, - Andreas -- http://mail.python.org/mailman/listinfo/python-list

Re: Deploying embedded Python

2007-12-17 Thread Andreas Raab
of information about what it is doing at startup. Thanks I'll do that. Cheers, - Andreas -- http://mail.python.org/mailman/listinfo/python-list

[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2007-12-13 Thread Andreas Hasenack
Andreas Hasenack added the comment: do it automatically. Unfortunately, that means that client-side certificate verification has to be done (it's pointless to look at the data in unverified certificates), and that means that the client software has to have an appropriate collection of root

[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2007-12-12 Thread Andreas Hasenack
Andreas Hasenack added the comment: At the least it should be made clear in the documentation that the hostname is not checked against the commonName nor the subjectAltName fields of the server certificate. And add some sample code to the documentation for doing a simple check. Something like

[issue1581] xmlrpclib.ServerProxy() doesn't use x509 data

2007-12-11 Thread Andreas Hasenack
Andreas Hasenack added the comment: The only difference between xmlrpclib.py from trunk and 2.5.1 is in the Marshaller class. Unrelated, as far as I can see. Note that it seems that the intent of the original code was to support this x509-dict all along: $ grep -n x509 xmlrpclib.py.trunk 1224

[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2007-12-11 Thread Andreas Hasenack
New submission from Andreas Hasenack: (I hope I used the correct component for this report) http://pypi.python.org/pypi/ssl/ I used the client example shown at http://docs.python.org/dev/library/ssl.html#client-side-operation to connect to a bank site called www.realsecureweb.com.br

[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2007-12-11 Thread Andreas Hasenack
Andreas Hasenack added the comment: Ups, typo in the script: cert = verisign-inc-class-3-public-primary.pem __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1589 __ ___ Python

<    3   4   5   6   7   8   9   10   11   >