Re: like py2exe, but on a mac

2008-07-31 Thread Python.Arno
oops didn't send it to the list... On 31 jul 2008, at 23:28, Python.Arno wrote: On 30 jul 2008, at 20:48, William McBrine wrote: On Wed, 30 Jul 2008 16:57:35 +, I wrote: [bundlebuidler] does put in a version-specific #! line, but if I change that to #!/usr/bin/env python, the app stil

Re: py2exe bug with email.MIMEText

2008-07-31 Thread Marcus.CM
Hi, After some debugging, i found the solution is to :- import email import email.mime.text import email.iterators import email.generator import email.utils Marcus. Marcus.CM wrote: There is a bug with py2exe when (at least under windows) when importing email # example testmime.py import e

py2exe bug with email.MIMEText

2008-07-31 Thread Marcus.CM
There is a bug with py2exe when (at least under windows) when importing email # example testmime.py import email msg = email.MIMEText.MIMEText("dsafdafdasfA") print "ok" 1. Save the text above and setup as testmime.py 2. Run it and u can see "ok" 3. Create setup.py and run : python setup.py py

Re: Difference between type and class

2008-07-31 Thread Nikolaus Rath
Steven D'Aprano <[EMAIL PROTECTED]> writes: > So, to the Original Poster: > > In Python, new-style classes and types are the same, but it is > traditional to refer to customer objects as "class" and built-in > objects as "types". Old-style classes are different, but you are > discouraged from using

Re: Difference between type and class

2008-07-31 Thread Nikolaus Rath
Miles <[EMAIL PROTECTED]> writes: > On Thu, Jul 31, 2008 at 1:59 PM, Nikolaus Rath wrote: >> If it is just a matter of different rendering, what's the reason for >> doing it like that? Wouldn't it be more consistent and straightforward >> to denote builtin types as classes as well? > > Yes, and in

Re: how to split text into lines?

2008-07-31 Thread alex23
Chris wrote: > or what about 'string'.splitlines(True) as that retains newline > characters. ;) Okay, you win :) Man, you'd think with the ease of object introspection I'd have at least looked at its docstring :) Cheers, Chris! -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions about asyncore

2008-07-31 Thread Frank Millman
On Jul 31, 10:39 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > On 31 Lug, 08:30, Frank Millman <[EMAIL PROTECTED]> wrote: > > > I don't know why you find more convenient running asyncore.loop in a > separate thread but if your purpose is writing a test suite in which a > client checks respon

Re: interpreter vs. compiled

2008-07-31 Thread castironpi
On Jul 31, 1:17 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > castironpi <[EMAIL PROTECTED]> wrote: > > >In C, we have: > > >int x, y; > >x= 10; > >y= x+ 1; > > >It translates as, roughly: > > >8000 .data > >7996 #x > >7992 #y > >7988 .end data > >7984 loadi reg0 7996 > >7980 loadi

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Erik Max Francis
Carl Banks wrote: If you recall, I agreed with his statement. Would you like to claim that I don't understand the fundamentals of Python? Since you've invented this connection out of nowhere, not particularly. I've never said anything about _anyone_ not understanding the fundamentals of Py

Re: Optimizing size of very large dictionaries

2008-07-31 Thread Terry Reedy
Raymond Hettinger wrote: Background: I'm trying to identify duplicate records in very large text based transaction logs. I'm detecting duplicate records by creating a SHA1 checksum of each record and using this checksum as a dictionary key. This works great except for several files whose size

Re: HELP - Attribute Error, no matter what I do on PAMIE...

2008-07-31 Thread alex23
On Aug 1, 1:00 am, frankrentef <[EMAIL PROTECTED]> wrote: > Greetings all. I'm new to PAMIE and I've watched / followed to PAMIE > videos on Show me Do. I've tried to duplicate the "scriptWrite" > function in an attempt to automate the forms process... without > success. I haven't seen the video,

Re: interpreter vs. compiled

2008-07-31 Thread Terry Reedy
Duncan Booth wrote: Terry Reedy <[EMAIL PROTECTED]> wrote: 1. Portability: The Microsoft C# JIT compiler runs under Windows .NET on x86/amd64 and maybe it64 and what else? Just porting .NET to run 0n Linux on the same processors was/is a bit task. Does MONO have a JIT also? Technically t

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Carl Banks
On Jul 31, 11:44 pm, Carl Banks <[EMAIL PROTECTED]> wrote: [snip excellent explanation of why it's hard to for "if x" to be extensively polymorphic] By the way, one thing I forgot to mention is Matt Fitzgibbons' filter example. As I said, it's hard to write code that works for both numeric and c

Re: How smart is the Python interpreter?

2008-07-31 Thread Terry Reedy
ssecorp wrote: def str_sort(string): s = "" for a in sorted(string): s+=a return s if i instead do: def str_sort(string): s = "" so = sorted(string) for a in so: s+=a return s will that be faster or the

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Carl Banks
On Jul 30, 10:05 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Russ P. wrote: > > On Jul 30, 1:07 am, Erik Max Francis <[EMAIL PROTECTED]> wrote: > >> Russ P. wrote: > >>> Oh, Lordy. I understand perfectly well how boolean tests, __len__, and > >>> __nonzero__ work in Python. It's very basic st

Re: Genital Hair Removal

2008-07-31 Thread Paul McGuire
On Jul 31, 10:40 pm, "dr.jonver" <[EMAIL PROTECTED]> wrote: > Genital Hair Removal > http://misspelled_words_in_URLs_are_funny.blogspot.com/2008/07/genital-hair-removal.html Python provides the del command, as in: del self.genital_hair If "Genital Hair" is an element in a list, you can remo

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Carl Banks
On Jul 31, 12:13 am, Ethan Furman <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > So I stand by the point I was trying to make: for your average day-to- > > day programming, the main benefit of "if x" is to save keystrokes. It > > doesn't help your code become more polymophic in practice. A li

Re: Decoding an attachment

2008-07-31 Thread Terry Reedy
[EMAIL PROTECTED] wrote: I figured out how to save an e-mail message as a text file, but I'm not sure how to decode the encoded part as I am not sure how much I need to include to decode it properly. Here is what a message looks like: The email.parser and email.message modules will do this fo

Re: win32com ChartObject pythonwin vs idle

2008-07-31 Thread Roger Upole
"sterling" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm curious as to why the difference between IDLE and pythonWin when > using win32com. > opening an excel file, i've attempted to grab the chart information > out of the file. > > commands like co = ChartObjects(1) works in

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Carl Banks
On Jul 31, 1:27 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > I'm really not sure where you're going with this or what you're trying > to prove. "if x" is a duck-type test for a boolean value. Obviously if > you know the type and want a more *specific* test, then you can use an > explicit one. An

Re: Non Continuous Subsequences

2008-07-31 Thread bearophileHUGS
Kay Schluehr: >[Yes, I have too much time...] Thank you for your code. If you allow me to, I may put some code derived from yours back into the rosettacode.org site. >Here is an evil imperative, non-recursive generator: I like imperative, non-recursive code :-) If you count the number of item

when does the GIL really block?

2008-07-31 Thread Craig Allen
I have followed the GIL debate in python for some time. I don't want to get into the regular debate about if it should be gotten rid of (though I am curious about the status of that for Python 3)... personally I think I can do multi-threaded programming well, but I also see the benefits of a multi

Decoding an attachment

2008-07-31 Thread robinsiebler
I figured out how to save an e-mail message as a text file, but I'm not sure how to decode the encoded part as I am not sure how much I need to include to decode it properly. Here is what a message looks like: Received: from INGESTOR2SQA ([10.220.83.198]) by sqaserver300 with Microsoft SMTPSVC(6

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Matthew Woodcraft
Steven D'Aprano wrote: >On Thu, 31 Jul 2008 22:01:48 +0100, Matthew Woodcraft wrote: >> The point is that if you tell people that "if x" is the standard way to >> check for emptiness, and also support a general principle along the >> lines of "write your function using the interfaces you expect, an

Re: Function References

2008-07-31 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On Jul 31, 10:47 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: I take the freedom to do so as I see fit - this is usenet... Fine, then keep beating a dead horse by replying to this thread with things that do nobody any good. It seems like there are a lot better w

Re: find and replace with regular expressions

2008-07-31 Thread MRAB
On Jul 31, 9:07 pm, [EMAIL PROTECTED] wrote: > I am using regular expressions to search a string (always full > sentences, maybe more than one sentence) for common abbreviations and > remove the periods.  I need to break the string into different > sentences but split('.') doesn't solve the whole p

Problem with pyodbc, Python?

2008-07-31 Thread john.goodleaf
I've just built pyodbc 2.0.58 against freetds and unixodbc. When I attempt to invoke it, either from the test script or from the interpreter, I get: ImportError: build/lib.linux-x86_64-2.5/pyodbc.so: undefined symbol: PyUnicodeUCS2_Resize I'm not quite sure how to go about troubleshooting this. M

Re: Python parsing iTunes XML/COM

2008-07-31 Thread John Machin
On Aug 1, 7:44 am, william tanksley <[EMAIL PROTECTED]> wrote: > John Machin <[EMAIL PROTECTED]> wrote: > > william tanksley <[EMAIL PROTECTED]> wrote: > > Let's try again: > > Cool. Sorry for the misunderstanding. Thank you for helping again! > > Postscript: your request to print the actual data d

Re: Attack a sacred Python Cow

2008-07-31 Thread Paul McGuire
On Jul 28, 12:15 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 28 Jul., 06:42, "Russ P." <[EMAIL PROTECTED]> wrote: > > > > > > > On Jul 27, 8:58 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > > On Jul 27, 2:39 pm, Bruno Desthuilliers > > > > <[EMAIL PROTECTED]> wrote: > > > > Derek Martin a éc

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Steven D'Aprano
On Thu, 31 Jul 2008 22:01:48 +0100, Matthew Woodcraft wrote: > Steven D'Aprano wrote: >>On Wed, 30 Jul 2008 20:55:03 +0100, Matthew Woodcraft wrote: > >>> On the other hand, iterators provide a clear example of problems with >>> "if x": __nonzero__ for iterators (in general) returns True even if

Re: simple problem with lists I am just forgetting

2008-07-31 Thread Paul McGuire
On Jul 31, 2:51 pm, Alexnb <[EMAIL PROTECTED]> wrote: > Lets say we have this list: > > funlist = ['a', 'b', 'c'] > > and lets say I do this: > > if funlist[4]: >     print funlist[4] > > I will get the exception "list index out of range" > > How can I test if the list item is empty without getting

Re: How smart is the Python interpreter?

2008-07-31 Thread Steven D'Aprano
On Thu, 31 Jul 2008 04:09:57 -0700, ssecorp wrote: > def str_sort(string): > s = "" > for a in sorted(string): > s+=a > return s > > > if i instead do: > > def str_sort(string): > s = "" > so = sorted(string) > for a in so: > s+=

Re: find and replace with regular expressions

2008-07-31 Thread Paul McGuire
On Jul 31, 3:07 pm, [EMAIL PROTECTED] wrote: > > middle_abbr = re.compile('[A-Za-z0-9]\.[A-Za-z0-9]\.') > When defining re's with string literals, it is good practice to use the raw string literal format (precede with an 'r'): middle_abbr = re.compile(r'[A-Za-z0-9]\.[A-Za-z0-9]\.') What abbre

Re: Difference between type and class

2008-07-31 Thread Miles
On Thu, Jul 31, 2008 at 1:59 PM, Nikolaus Rath wrote: > If it is just a matter of different rendering, what's the reason for > doing it like that? Wouldn't it be more consistent and straightforward > to denote builtin types as classes as well? Yes, and in Python 3, it will be so: >>> class myint(

Re: Difference between type and class

2008-07-31 Thread Steven D'Aprano
On Thu, 31 Jul 2008 13:32:39 +0200, Thomas Troeger wrote: >> Can someone explain to me the difference between a type and a class? > > If your confusion is of a more general nature I suggest reading the > introduction of `Design Patterns' (ISBN-10: 0201633612), under > `Specifying Object Interface

Re: Standard module for parsing emails?

2008-07-31 Thread Steven D'Aprano
On Thu, 31 Jul 2008 02:25:37 +, Steven D'Aprano wrote: > On Wed, 30 Jul 2008 07:11:45 -0700, Phillip B Oldham wrote: > >> Most clients use ">" which is easy to check for, but I've seen some >> which use "|" and some which *don't* quote at all. Its causing us >> nightmares in parsing responses

Re: Python parsing iTunes XML/COM

2008-07-31 Thread Jerry Hill
On Thu, Jul 31, 2008 at 9:44 AM, william tanksley <[EMAIL PROTECTED]> wrote: > I'm using a file, a file that's correctly encoded as UTF-8, and it > returns some text elements that are raw bytes (undecoded). I have to > manually decode them. I can't reproduce this behavior. Here's a simple test ca

Re: Python parsing iTunes XML/COM

2008-07-31 Thread william tanksley
John Machin <[EMAIL PROTECTED]> wrote: > william tanksley <[EMAIL PROTECTED]> wrote: > Let's try again: Cool. Sorry for the misunderstanding. Thank you for helping again! Postscript: your request to print the actual data did the trick. I'm including the rest of my reply just to provide context, b

saving an e-mail attachement

2008-07-31 Thread robinsiebler
I'm trying to figure out how to save an e-mail attachment from a POP3 mailbox. I've scoured the web, but -none- of the examples I have found have actually worked. For instance, in this example: http://groups.google.com/group/comp.lang.python/browse_thread/thread/8423cad79ff21730/0d8922943a164ccf?

Re: find and replace with regular expressions

2008-07-31 Thread Mensanator
On Jul 31, 3:56 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On Jul 31, 3:07 pm, [EMAIL PROTECTED] wrote: > > > > > > > I am using regular expressions to search a string (always full > > sentences, maybe more than one sentence) for common abbreviations and > > remove the periods.  I need to break th

Re: Non Continuous Subsequences

2008-07-31 Thread Kay Schluehr
Here is an evil imperative, non-recursive generator: def ncsub(seq): n = len(seq) R = xrange(n+1) for i in xrange(1,2**n): S = [] nc = False for j in R: k = i>>j if k == 0: if nc: yield S

Newbie having issues with threads

2008-07-31 Thread James Calivar
I'm a newbie trying to write a script that uses threads. I'm right now a little bit stuck in understanding why the code snippet I wrote doesn't seem to be entering the function defined in the start_new_thread() call. If I run it as is (the threaded version), the output is: UA_1 configuring... UA

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Matthew Woodcraft
Steven D'Aprano wrote: >On Wed, 30 Jul 2008 20:55:03 +0100, Matthew Woodcraft wrote: >> On the other hand, iterators provide a clear example of problems with >> "if x": __nonzero__ for iterators (in general) returns True even if they >> are 'empty'. > How do you propose telling whether an iterato

Re: find and replace with regular expressions

2008-07-31 Thread Mensanator
On Jul 31, 3:07 pm, [EMAIL PROTECTED] wrote: > I am using regular expressions to search a string (always full > sentences, maybe more than one sentence) for common abbreviations and > remove the periods.  I need to break the string into different > sentences but split('.') doesn't solve the whole p

Re: Python parsing iTunes XML/COM

2008-07-31 Thread John Machin
On Jul 31, 11:54 pm, william tanksley <[EMAIL PROTECTED]> wrote: > John Machin <[EMAIL PROTECTED]> wrote: > > william tanksley <[EMAIL PROTECTED]> wrote: > > > "Buffett Time - Annual Shareholders\xc2\xa0L.mp3" > > > 1. This isn't Unicode; it's missing the u"" (I printed using repr). > > > 2. It's g

Re: Questions about asyncore

2008-07-31 Thread Giampaolo Rodola'
On 31 Lug, 08:30, Frank Millman <[EMAIL PROTECTED]> wrote: > On Jul 30, 7:50 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > > On 30 Lug, 09:49, Frank Millman <[EMAIL PROTECTED]> wrote: > > Thanks again, Giampaolo, your input is really appreciated. > > > > > I pretty much have the same overv

Re: Hobbyist - Python vs. other languages

2008-07-31 Thread Matthew Fitzgibbons
fprintf wrote: I have been playing with computers since I first learned to program moving shapes on an Atari 800XL in BASIC. After many years of dabbling in programming languages as a hobbyist (I am not a computer scientist or other IT professional), I have never found a way to stick with a langu

Re: Case tagging and python

2008-07-31 Thread chrispoliquin
I second the idea of just using the islower(), isupper(), and istitle() methods. So, you could have a function - let's call it checkCase() - that returns a string with the tag you want... def checkCase(word): if word.islower(): tag = 'nocap' elif word.isupper(): tag = 'al

Re: Case tagging and python

2008-07-31 Thread Fred Mangusta
Hi, I came up with the following procedure ALLCAPS = "|ALLCAPS" NOCAPS = "|NOCAPS" MIDCAPS = "|MIDCAPS" CAPS = "|CAPS" DIGIT = "|DIGIT" def test_case(w): w_out = '' if w.isalpha(): #se la virgola non ci entra if w.isupper(): w_out = w.lower() + ALLCAPS r

find and replace with regular expressions

2008-07-31 Thread chrispoliquin
I am using regular expressions to search a string (always full sentences, maybe more than one sentence) for common abbreviations and remove the periods. I need to break the string into different sentences but split('.') doesn't solve the whole problem because of possible periods in the middle of a

Re: Hobbyist - Python vs. other languages

2008-07-31 Thread bearophileHUGS
fprintf: > and yet they all end at the point where a person has enough > knowledge of the syntax, but not really enough to do anything. A programming language is a tool to solve problems, so first of all: do you have problems to solve? You can create some visualizations, some program with GUI, som

Re: simple problem with lists I am just forgetting

2008-07-31 Thread bearophileHUGS
Alexnb: > How can I test if the list item is empty without getting that exception? In Python such list cell isn't empty, it's absent. So you can use len(somelist) to see how much long the list is before accessing its items. Often you can iterate on the list with a for, so you don't need to care of

simple problem with lists I am just forgetting

2008-07-31 Thread Alexnb
Lets say we have this list: funlist = ['a', 'b', 'c'] and lets say I do this: if funlist[4]: print funlist[4] I will get the exception "list index out of range" How can I test if the list item is empty without getting that exception? -- View this message in context: http://www.nabble.co

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Matthew Fitzgibbons
Matthew Fitzgibbons wrote: Steven D'Aprano wrote: On Wed, 30 Jul 2008 09:23:05 -0600, Matthew Fitzgibbons wrote: If you're expecting a list (and only a list) then your point makes sense. 'if x' can get you into trouble if you _don't_ want its polymorphism. "if x" is hardly unique in that way

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Matthew Fitzgibbons
Steven D'Aprano wrote: On Wed, 30 Jul 2008 09:23:05 -0600, Matthew Fitzgibbons wrote: If you're expecting a list (and only a list) then your point makes sense. 'if x' can get you into trouble if you _don't_ want its polymorphism. "if x" is hardly unique in that way. If you're expecting a list

Re: Hobbyist - Python vs. other languages

2008-07-31 Thread Serdar Tumgoren
>From this noob's perspective, I'd say take a look at Magnus Lie Hetland's Beginning Pythonbook. It covers the core syntax (which it sounds like you're familiar with already) and then includes a bunch of projects, from text p

Re: Hobbyist - Python vs. other languages

2008-07-31 Thread Mike Driscoll
On Jul 31, 1:32 pm, fprintf <[EMAIL PROTECTED]> wrote: > I have been playing with computers since I first learned to program > moving shapes on an Atari 800XL in BASIC. After many years of dabbling > in programming languages as a hobbyist (I am not a computer scientist > or other IT professional),

Hobbyist - Python vs. other languages

2008-07-31 Thread fprintf
I have been playing with computers since I first learned to program moving shapes on an Atari 800XL in BASIC. After many years of dabbling in programming languages as a hobbyist (I am not a computer scientist or other IT professional), I have never found a way to stick with a language far enough to

Re: Difference between type and class

2008-07-31 Thread Nikolaus Rath
Maric Michaud <[EMAIL PROTECTED]> writes: >>> What the means is that int is not a user type but a >>> builtin type, instances of int are not types (or classes) but common >>> objects, so its nature is the same as any classes. >>> >>> The way it prints doesn't matter, it's just the __repr__ of any

Re: Python parsing iTunes XML/COM

2008-07-31 Thread Stefan Behnel
william tanksley wrote: > I didn't > pass a string. I passed a file. It didn't error out; instead, it > produced bytestring-encoded output (not Unicode). >From my experience (and from the source code I have seen so far), ElementTree does not return UTF-8 encoded strings at the API level. Can you p

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Matthew Fitzgibbons
Steven D'Aprano wrote: On Wed, 30 Jul 2008 09:23:05 -0600, Matthew Fitzgibbons wrote: If you're expecting a list (and only a list) then your point makes sense. 'if x' can get you into trouble if you _don't_ want its polymorphism. "if x" is hardly unique in that way. If you're expecting a list

Re: Non Continuous Subsequences

2008-07-31 Thread Mensanator
On Jul 30, 11:32 am, [EMAIL PROTECTED] wrote: > This post is not about practical stuff, so if you have little time, > you may ignore it. > > This is a task of the rosettacode.org > site:http://www.rosettacode.org/wiki/Non_Continuous_Subsequences > > A subsequence contains some subset of the elemen

Re: Non Continuous Subsequences

2008-07-31 Thread bearophileHUGS
Bruce Frederiksen: Your solution is a bit different from what I was thinking about (I was thinking about a generator function, with yield), but it works. This line: > return itertools.chain( >itertools.imap(lambda ys: x + ys, ncsub(xs, s + p1)), >nc

Re: Function References

2008-07-31 Thread Chris Mellon
On Thu, Jul 31, 2008 at 10:27 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Jul 31, 10:47 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> I take the freedom to do so as I see fit - this is usenet... > > Fine, then keep beating a dead horse by replying to this thread with > things that

Re: Function References

2008-07-31 Thread Carsten Haese
[EMAIL PROTECTED] wrote: Greetings, I'm trying to wrap a function in a C library as a compiled C Python module. Everything is going great, but I've hit a snag. There's a function in the form of this: First the typedef: typedef void(*FPtr_DeviceMessageHandler) (const DeviceMessage, const char*);

Re: problem when reading file

2008-07-31 Thread Bruce Frederiksen
On Thu, 31 Jul 2008 23:44:33 +1000, shrimpy wrote: > hi every one, i am new to python, > and coz i want to write a handy command for my linux machine, to find > a word in all the files which are under the current folder. > > the code is half done, but when i run it, it complain, and i don`t know

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-31 Thread Chris Mellon
On Tue, Jul 29, 2008 at 3:37 AM, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jul 28, 8:15 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> On Mon, 28 Jul 2008 13:22:37 -0700, Carl Banks wrote: >> > On Jul 28, 10:00 am, Steven D'Aprano <[EMAIL PROTECTED] >> > cybersource.com.au>

Re: Non Continuous Subsequences

2008-07-31 Thread Bruce Frederiksen
On Wed, 30 Jul 2008 09:32:25 -0700, bearophileHUGS wrote: > This post is not about practical stuff, so if you have little time, > you may ignore it. > > This is a task of the rosettacode.org site: > http://www.rosettacode.org/wiki/Non_Continuous_Subsequences > > A subsequence contains some subse

Re: Function References

2008-07-31 Thread Matthew Woodcraft
>> Ctypes is a since python2.5 built-in module that allows to declare >> interfaces to C-libraries in pure python. You declare datatypes and >> function prototypes, load a DLL/SO and then happily work with it. No C, no >> compiler, no refcounts, no nothing. >> >> And you can pass python-functions a

Re: How smart is the Python interpreter?

2008-07-31 Thread Gary Herron
ssecorp wrote: def str_sort(string): s = "" for a in sorted(string): s+=a return s if i instead do: def str_sort(string): s = "" so = sorted(string) for a in so: s+=a return s will that be faster or the i

Re: current week / weeks in year - best practice

2008-07-31 Thread Aljosa Mohorovic
On Jul 31, 5:42 pm, Aljosa Mohorovic <[EMAIL PROTECTED]> wrote: > what if i know current context week = 20 (example), what would be the > best way to get datetime objects for first and last day of current > context week? > by "current context week" i don't mean current week for current year > but c

Re: Newbie Python questions

2008-07-31 Thread Mike Driscoll
On Jul 29, 12:28 pm, LessPaul <[EMAIL PROTECTED]> wrote: > I recently discovered Python and see it as a great language to use for > personal projects (and more). I made my living for over a decade as a > coder in C, C++, ADA, Fortran, and Assembly before moving to systems > engineering. > > I'm now

Re: current week / weeks in year - best practice

2008-07-31 Thread Aljosa Mohorovic
On Jul 31, 3:58 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Instead of datetime.now() use date.today(), which removes a lot of > boilerplate. > > int(date.today().strftime("%W")) > > Apart from that, I think it's the way to go. what if i know current context week = 20 (example), what would

Re: Newbie Python questions

2008-07-31 Thread binaryjesus
One great open source GUI package that you left out is GTK ie. pygtk. i cant compare it with wx as i have never used it but isay its much better than QT. Anyway for ur q if u want to compair qt n wx. QT should be faster coz it has a better documentation. and welcome to the python family! kind re

Re: Difference between type and class

2008-07-31 Thread Maric Michaud
Le Thursday 31 July 2008 17:00:51 Nikolaus Rath, vous avez écrit : > > There are some confusion about the terms here. > > > > Classes are instances of type 'type', > > Could you please clarify what you mean with 'instance of type X'? I > guess you mean that 'y is an instance of type X' iif y is con

Re: undo a dictionary

2008-07-31 Thread mmm
Gabriel, I meant the latter, so this helps > Or, do you mean you already have those names and values, perhaps mixed   > with a lot more names, and want to extract only those starting with "x"   > and following with a number? > > result = {} > for name, value in vars(): # or locals().items(), or g

Re: Difference between type and class

2008-07-31 Thread Nikolaus Rath
Maric Michaud <[EMAIL PROTECTED]> writes: > Le Thursday 31 July 2008 16:46:28 Nikolaus Rath, vous avez écrit : >> Maric Michaud <[EMAIL PROTECTED]> writes: >> >> > Can someone explain to me the difference between a type and a class? >> >> >> >> If your confusion is of a more general nature I sugges

Re: Function References

2008-07-31 Thread [EMAIL PROTECTED]
On Jul 31, 10:47 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > I take the freedom to do so as I see fit - this is usenet... Fine, then keep beating a dead horse by replying to this thread with things that do nobody any good. It seems like there are a lot better way to waste time, though. Th

Re: Swap memory in Python ? - three questions

2008-07-31 Thread John Nagle
Robert LaMarca wrote: Hi, I am using numpy and wish to create very large arrays. My system is AMD 64 x 2 Ubuntu 8.04. Ubuntu should be 64 bit. I have 3gb RAM and a 15 GB swap drive. Does a full 64-bit version of CPython, one where all pointers and sizes are 64 bits, even exist?

Re: win32com ChartObject pythonwin vs idle

2008-07-31 Thread sterling
On Jul 31, 4:28 am, Tim Golden <[EMAIL PROTECTED]> wrote: > sterling wrote: > > I'm curious as to why the difference between IDLE and pythonWin when > > using win32com. > > opening an excel file, i've attempted to grab the chart information > > out of the file. > > > commands like co = ChartObjects

Re: Difference between type and class

2008-07-31 Thread Nikolaus Rath
Maric Michaud <[EMAIL PROTECTED]> writes: > Le Thursday 31 July 2008 14:30:19 Nikolaus Rath, vous avez écrit : >> oj <[EMAIL PROTECTED]> writes: >> > On Jul 31, 11:37 am, Nikolaus Rath <[EMAIL PROTECTED]> wrote: >> >> So why does Python distinguish between e.g. the type 'int' and the >> >> class 'm

Re: Difference between type and class

2008-07-31 Thread Maric Michaud
Le Thursday 31 July 2008 16:46:28 Nikolaus Rath, vous avez écrit : > Maric Michaud <[EMAIL PROTECTED]> writes: > >> > Can someone explain to me the difference between a type and a class? > >> > >> If your confusion is of a more general nature I suggest reading the > >> introduction of `Design Patte

HELP - Attribute Error, no matter what I do on PAMIE...

2008-07-31 Thread frankrentef
Greetings all. I'm new to PAMIE and I've watched / followed to PAMIE videos on Show me Do. I've tried to duplicate the "scriptWrite" function in an attempt to automate the forms process... without success. Can someone PLEASE Assist!? I'm using the following code from cPAMIE import PAMIE #I

Re: Function References

2008-07-31 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: >> How much more liberal can it get than MIT-licensed? > > Again, the licensing issue is everything to do with the original > library distributor, NOT ctypes. I read library distributor as "ctypes-library distributor" because it is 3rd-party under 2.4. Which was the reas

Re: Difference between type and class

2008-07-31 Thread Nikolaus Rath
Maric Michaud <[EMAIL PROTECTED]> writes: >> > Can someone explain to me the difference between a type and a class? >> >> If your confusion is of a more general nature I suggest reading the >> introduction of `Design Patterns' (ISBN-10: 0201633612), under >> `Specifying Object Interfaces'. >> >> In

Re: Function References

2008-07-31 Thread [EMAIL PROTECTED]
> How much more liberal can it get than MIT-licensed? Again, the licensing issue is everything to do with the original library distributor, NOT ctypes. > But then, if you insist, go down the hard road. Irrelevant and unnecessary. If you don't want to help, don't please don't reply. -- http://mai

Re: Function References

2008-07-31 Thread Diez B. Roggisch
Diez B. Roggisch wrote: > [EMAIL PROTECTED] wrote: > >>> Ctypes is a since python2.5 built-in module that allows to declare >>> interfaces to C-libraries in pure python. You declare datatypes and >>> function prototypes, load a DLL/SO and then happily work with it. No C, >>> no compiler, no refco

Re: Function References

2008-07-31 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: >> Ctypes is a since python2.5 built-in module that allows to declare >> interfaces to C-libraries in pure python. You declare datatypes and >> function prototypes, load a DLL/SO and then happily work with it. No C, >> no compiler, no refcounts, no nothing. >> >> And you c

Re: Need help in writing up a Python Syntax checker

2008-07-31 Thread [EMAIL PROTECTED]
On Jul 14, 8:22 am, Kinokunya <[EMAIL PROTECTED]> wrote: > Hi guys, > > My group and I will be working on our final year project, the scope to > do a program/web-based application similar areas of functionalities > like thePyLintand PyChecker; a Python syntax checker. We have no > Python background

Re: Function References

2008-07-31 Thread [EMAIL PROTECTED]
> Ctypes is a since python2.5 built-in module that allows to declare > interfaces to C-libraries in pure python. You declare datatypes and > function prototypes, load a DLL/SO and then happily work with it. No C, no > compiler, no refcounts, no nothing. > > And you can pass python-functions as call

Re: working pylint anyone?

2008-07-31 Thread [EMAIL PROTECTED]
On Jul 31, 2:39 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Which version of python-logilab-common and python-logilab-astng are > > installed on your machine ? > > By now, pylint 0.14 with logilab.common 0.27 and astng 0.17.2 > > I was able to track down the problem as being related to a

Re: Function References

2008-07-31 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hello Diez. > >> May I suggest you move to ctypes for wrapping? It's easier, pure python >> and callbacks are already built-in. > > I'm pretty new to extending Python in C, I don't understand what > you're saying. Are there any examples or a brief explanation/URL you >

Re: Function References

2008-07-31 Thread [EMAIL PROTECTED]
Hello Diez. > May I suggest you move to ctypes for wrapping? It's easier, pure python and > callbacks are already built-in. I'm pretty new to extending Python in C, I don't understand what you're saying. Are there any examples or a brief explanation/URL you could point me to? -- http://mail.pyth

Re: Function References

2008-07-31 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Greetings, > > I'm trying to wrap a function in a C library as a compiled C Python > module. Everything is going great, but I've hit a snag. There's a > function in the form of this: > > First the typedef: > typedef void(*FPtr_DeviceMessageHandler) (const DeviceMessage

Re: current week / weeks in year - best practice

2008-07-31 Thread Diez B. Roggisch
Aljosa Mohorovic wrote: > i use this to find out current week and total number of weeks for > current year: > now = datetime.now() > weeks_in_year = int(date(now.year, 12, 31).strftime("%W")) > current_week = int(date(now.year, now.month, now.day).strftime("%W")) > > is this the best way or is th

Debugging of a long running process under Windows

2008-07-31 Thread Propad
Hello, I know this issue pops up once in a while, but I haven't found a good answer to it. I need to debug a long running application under windows. The application is a combined java/python framework for testing ECUs in the automotive industry. Basically, the Java GUI (Eclipse-based) starts test-c

Re: Python parsing iTunes XML/COM

2008-07-31 Thread william tanksley
John Machin <[EMAIL PROTECTED]> wrote: > william tanksley <[EMAIL PROTECTED]> wrote: > > "Buffett Time - Annual Shareholders\xc2\xa0L.mp3" > > 1. This isn't Unicode; it's missing the u"" (I printed using repr). > > 2. It's got the UTF-8 bytes there in the middle. > > In addition to the above result

Function References

2008-07-31 Thread [EMAIL PROTECTED]
Greetings, I'm trying to wrap a function in a C library as a compiled C Python module. Everything is going great, but I've hit a snag. There's a function in the form of this: First the typedef: typedef void(*FPtr_DeviceMessageHandler) (const DeviceMessage, const char*); Then the actual function

Re: problem when reading file

2008-07-31 Thread Heiko Wundram
Am Donnerstag, 31. Juli 2008 15:44:33 schrieb shrimpy: > hi every one, i am new to python, > and coz i want to write a handy command for my linux machine, to find > a word in all the files which are under the current folder. What about grep -R "myword" . ? Even works on regular expression (with

Python Contractor needed

2008-07-31 Thread Rakesh Thakrar
Hi All, An opportunity for a talented Python Software Engineer has arisen to join a company which is currently going through a phase of rapid expansion. Candidates must have excellent software development skills to join an established team within this small company with offices in the U.K. and

  1   2   >