Re: XMLRPC Solution Code

2006-07-18 Thread Frank Millman
Steve Holden wrote: > dylpkls91 wrote: > > > > The hard part now is getting the server code to run as a Windows > > service- argh!!! > > I can get it installed and started using modified code from: > > http://www.schooltool.org/products/schooltool-calendar/documentation/how-to/running-as-a-windows

Re: range() is not the best way to check range?

2006-07-18 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, tac-tics wrote: > Grant Edwards wrote: >> for pete's sake use the comparison operator like god intended. >> >> if 0 <= i <= 1: > > I'm assuming you used Python's compound comparison as opposed to the > C-style of and'ing two comparisons together to emphasize the fa

Re: Coding style

2006-07-18 Thread Peter Otten
Carl Banks wrote: > > Peter Otten wrote: >> Carl Banks wrote: >> >> > def process_values(lst): >> > if not lst: >> > return >> > do_expensive_initialization_step() >> > for item in lst: >> > do_something_with(item) >> > do_expensive_fina

Re: function v. method

2006-07-18 Thread Leif K-Brooks
danielx wrote: > This is still a little bit of magic, which gets me thinking again about > the stuff I self-censored. Since the dot syntax does something special > and unexpected in my case, why not use some more dot-magic to implement > privates? Privates don't have to be entirely absent from Klas

Re: XMLRPC Solution Code

2006-07-18 Thread Laszlo Nagy
> I'm afraid you'll need to Google for "python windows service" or > similar: in essence the main thing the service has to do (besides serve) > is ensure a continuous flow of messages through the system. It's ugly, > but people have done it before. > Also don't forget to "Allow the service i

Re: Augument assignment versus regular assignment

2006-07-18 Thread Antoon Pardon
On 2006-07-17, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: > >>AP> On 2006-07-14, Piet van Oostrum <[EMAIL PROTECTED]> wrote: > Just read what it says. `It is only evaluated once' is quite clear I would say. > >>AP> If it is so clear, w

Re: function v. method

2006-07-18 Thread Duncan Booth
danielx wrote: Foo.func = dan# <-- Appearantly, something magical happens here, because... Foo.func > f = Foo.func f is dan # <-- things begins to look suprising here. > False ismethod(f) > True > > Imagine my surprise. Why would Python do this? > Not

Re: win32com.client.Dispatch - understanding error messages

2006-07-18 Thread Duncan Booth
wrote: False > False blah = win32com.client.Dispatch('MSXML2.XMLHTTP') blah.open("POST", "12.5.81.49/crg_cbsil_vtest_52/crg.aspx", False) Does using an absolute URL for the url parameter help any? You've specified a relative URL (i.e. the folder 12.5.81.49 under the current locat

Re: Google Earth contact? (OT, sort of...)

2006-07-18 Thread Duncan Booth
Bell, Kevin wrote: > Sorry if this is an off topic shot in the dark, but... > > Does anyone know a contact for anyone that works for Google Earth? I > wanted to shoot 'em an email about a possible enhancement, but they're > smart enough to not leave contact info ANYWHERE on their websites. > Ho

Re: unicode html

2006-07-18 Thread Duncan Booth
wrote: > As an example I would like to do this kind of conversion: > \uc3B4 => ô > for all available html entities. >>> u"\u3cB4".encode('ascii','xmlcharrefreplace') '㲴' Don't bother using named entities. If you encode your unicode as ascii replacing all non-ascii characters with the xml enti

Re: how to know if socket is still connected

2006-07-18 Thread Laszlo Nagy
[EMAIL PROTECTED] írta: > ok, yeah, thats in my book. > thanks, and no, it isn't enabled. > thanks again for everything > -sk > Another hint: use select.select() on the socket before reading. It will tell you if recv() will block or not. This way you can implement your own async timeout and do

Re: range() is not the best way to check range?

2006-07-18 Thread Nick Craig-Wood
Grant Edwards <[EMAIL PROTECTED]> wrote: > Creating and then searching a 10,000 element list to see if a > number is between two other numbers is insane. > Using xrange as somebody else suggested is also insane. Aye to both > If you want to know if a number is between two other numders, > f

Re: function v. method

2006-07-18 Thread Bruno Desthuilliers
danielx wrote: > At first I was going to post the following: > > > (snip) > > > > but then I tried this: > > res = Foo.__dict__['func'] res is dan > > True > > And it all started to make sense. The surprising thing turned out to be > not so surprising: When the expression Foo.func

Python Developer required for 6 Months Contract - South West UK

2006-07-18 Thread Rakesh Thakrar
My client based in the South West - UK is looking for a Python Developer to join an existing project team for a 6-month contract. Suitable candidates will have commercial experience programming with Python and knowledge of Software Design Architecture. Ideally you will have knowledge any one of th

Re: Coding style

2006-07-18 Thread Bruno Desthuilliers
tac-tics wrote: >>Or even just: >> >>lst = [] >> >>;-) > > > Indeed. > > I'd say the second one. And you'd be plain wrong. > Empty lists are not false. In a bolean context, empty containers (lists, tuples, dicts, sets etc), empty strings, integer 0, float 0.0 and None are all false. This is

Re: Accessors in Python (getters and setters)

2006-07-18 Thread mystilleef
Bruno Desthuilliers wrote: > mystilleef wrote: > Please don't top-post > > On State and Behavior: > > > > To understand objects in terms of state and behavior you need to > > absolve yourself from implementation details of languages > > and think at an abstract level. > > > > > Take a button objec

Re: Coding style

2006-07-18 Thread Bruno Desthuilliers
tac-tics wrote: > dwelch91 wrote: > >>tac-tics wrote: >> >>>I'd say the second one. Empty lists are not false. They are empty. Long >>>live dedicated boolean data types. >>> >> >>Uh, no, empty lists are False in a boolean context: >> >>http://docs.python.org/lib/truth.html >> >>-Don > > > Perhap

Re: Coding style

2006-07-18 Thread Bruno Desthuilliers
dwelch91 wrote: > PTY wrote: > >> Which is better? >> >> lst = [1,2,3,4,5] >> >> while lst: >> lst.pop() >> >> OR >> >> while len(lst) > 0: >> lst.pop() >> > > I think the first one is better, but if all you are doing is removing > all the items in the list, this is definitely better: > > ls

Python : Event-Driven Paradigm

2006-07-18 Thread Kusanagi
Hi All,       I have been looking through wikipedia at the Event-Driven Page http://en.wikipedia.org/wiki/Event-driven_programming and I noticed that it mentions that TCL has event driven programming built in. I also looked over the Python 3000 proposals and I did not notice any mention of f

Re: Accessors in Python (getters and setters)

2006-07-18 Thread mystilleef
Bruno Desthuilliers wrote: > mystilleef wrote: > > Gerhard Fiedler wrote: > > > >>On 2006-07-15 06:55:14, mystilleef wrote: > >> > >> > >>>In very well designed systems, the state of an object should only be > >>>changed by the object. > >> > >>IMO that's not quite true. Ultimately, the state alwa

Re: Google Earth contact? (OT, sort of...)

2006-07-18 Thread Daniel Fischer
Bell, Kevin! > Does anyone know a contact for anyone that works for Google Earth? I > wanted to shoot 'em an email about a possible enhancement, but they're > smart enough to not leave contact info ANYWHERE on their websites. They do have a form for sales inquiry, though. Of course, when I sen

tkinter wm_delete_window

2006-07-18 Thread yvesd
hello i want to intercept tkinter python system events like wm_delete_window and if possible for any window, but the newest code I've produced give me an error : Traceback (most recent call last): File "C:\Documents and Settings\yvesd\Bureau\protowin.py", line 36, in ? b1 = Tkinter.Button (w

Re: Coding style

2006-07-18 Thread Bruno Desthuilliers
PTY wrote: > Bob Greschke wrote: > >><[EMAIL PROTECTED]> wrote in message >>news:[EMAIL PROTECTED] >> >>>PTY wrote: >>> Which is better? lst = [1,2,3,4,5] while lst: lst.pop() OR while len(lst) > 0: lst.pop() >>> >>>A dozen posts, but nobody has

Re: range() is not the best way to check range?

2006-07-18 Thread Paul Boddie
John Machin wrote: > On 18/07/2006 12:41 PM, [EMAIL PROTECTED] wrote: > > it seems that range() can be really slow: [...] > Some things to try: > 1a. Read what the manual has to say about the range() function ... what > does it produce? Indeed. Still, the addition of a __contains__ method to ran

Re: Coding style

2006-07-18 Thread Bruno Desthuilliers
Carl Banks wrote: > Patrick Maupin wrote: > >>PTY wrote: >> >> >>>It looks like there are two crowds, terse and verbose. I thought terse >>>is perl style and verbose is python style. BTW, lst = [] was not what >>>I was interested in :-) I was asking whether it was better style to >>>use len() o

How to use ParseTuple with unknown number of args?

2006-07-18 Thread ondekoza
Hi, I am embedding python in a large application, written in C. To allow access to the internals of the app, I embedded python as recommended by the `extending and embedding'-document on python.org. Most functions that are now callable from python have fixed number of args and are easy to parse wi

Re: Augument assignment versus regular assignment

2006-07-18 Thread Antoon Pardon
On 2006-07-17, Paul Boddie <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> >> What the language reference should have said IMO is that in case x >> is an attribute reference, index or slicing, the primary expression >> will be evaluated only once, as will be the index or slice in the >> two la

Re: Coding style

2006-07-18 Thread Bruno Desthuilliers
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Bob Greschke wrote: > > >>I'd go even one step further. Turn it into English (or your favorite >>non-computer language): >> >>1. While list, pop. >> >>2. While the length of the list is greater than 0, pop. >> >>Which one makes more se

Re: Augument assignment versus regular assignment

2006-07-18 Thread Antoon Pardon
On 2006-07-17, Terry Reedy <[EMAIL PROTECTED]> wrote: > "Antoon Pardon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> On 2006-07-15, Terry Reedy <[EMAIL PROTECTED]> wrote: >>> The problem with understanding augmented assignment is that it directs >>> the >>> compiler and inte

Re: How to use ParseTuple with unknown number of args?

2006-07-18 Thread ondekoza
With some more research on comp.lang.python I found that this topic has been discussed earlier to some extend. One recommendation was to use numpy. This would introduce an additional dependency which I try to avoid. The earlier posts generally highlight some specific feature of calling with array

Python linker

2006-07-18 Thread byteschreck
I love python - I use it as a utility language to complement my C# programming every day. However, the reason I do not use it as my primary language is - surprise, surprise - not its lack of static type checking, but the size of standalone executes (which embed the python runtime). Would it be po

Re: tkinter wm_delete_window

2006-07-18 Thread Eric Brunel
On Tue, 18 Jul 2006 11:16:04 +0200, yvesd <[EMAIL PROTECTED]> wrote: > hello i want to intercept tkinter python system events like > wm_delete_window > and if possible for any window, but the newest code I've produced give > me > an error : > Traceback (most recent call last): > File "C:\Document

Re: Augument assignment versus regular assignment

2006-07-18 Thread Paul Boddie
Antoon Pardon wrote: > > Now maybe I'm just not bright enough, so maybe you can explain what > something like col['t'] is evaluated to in a statement like: > > col['t'] = exp In the notation given earlier, let us say that it would be this: namespace = col setitem(namespace, "t", exp) Note that

Re: What is a type error?

2006-07-18 Thread Joachim Durchholz
Marshall schrieb: > Chris Smith wrote: >> Joachim Durchholz <[EMAIL PROTECTED]> wrote: >> I *think* I understand Marshall here. When you are saying "assignment", >> you mean assignment to values of attributes within tuples of the cell. >> When Marshall is saying "assignment", he seems to mean assi

Re: range() is not the best way to check range?

2006-07-18 Thread Andy Dingley
[EMAIL PROTECTED] wrote: > it seems that range() can be really slow: > if i in range (0, 1): RTFM on range() You're completely mis-using it here, using it with an if ... in ... test. The purpose of range() in Python is as loop control, not comparisons! It's not a SQL BETWEEN statement

Re: New SourceForge project: Diet Python!!!

2006-07-18 Thread skip
>> Diet Python is a flavor of Python with allegro, multiarray, umath, >> calldll, npstruct and curses builtin, all else nonessential to >> language ripped out. Total size < 3MB, 1% of PSF Python. Diet Python >> helps keep clients thin :) Just an FYI, but Python 2.5 comes with ctyp

Getting and Setting Cookies

2006-07-18 Thread Vlad Dogaru
Hello, I am trying to use cookies and Python to create a simple login example. But I am very disoriented at the existence of two cookie libraries, namely Cookie and cookielib. I have seen examples of setting cookies (although I am still not sure about timestamps and cookie lifespan), but no refere

Re: How to use ParseTuple with unknown number of args?

2006-07-18 Thread Daniel Dittmar
ondekoza wrote: > The earlier posts generally highlight some specific feature of calling > with arrays. Can someone point me to a piece of software, where sth. > like this is actually used? Python source/Objects/stringobject.c string_join would be an example if you only allow a list or tuple. Py

Re: range() is not the best way to check range?

2006-07-18 Thread Leif K-Brooks
Grant Edwards wrote: > Using xrange as somebody else suggested is also insane. Sorry about that, I somehow got the misguided notion that xrange defines its own __contains__, so that it would be about the same speed as using comparison operators directly. I figured the OP might have a better rea

Re: Track keyboard and mouse usage

2006-07-18 Thread skip
Dennis> Problem: X-Window supports remote displays; you'd need a means Dennis> of specifying which display to track (unless you've opened a GUI Dennis> application and that application is asking for positions ... Watch does this via server mode (sort of). You run watch on both your l

Re: What is a type error?

2006-07-18 Thread Joachim Durchholz
Marshall schrieb: > No. The variable is the table, not the records. In your examples, yes. > Relations are not arrays. They are, in all ways that matter for aliasing: They are a collection of mutable data, accessible via selector values. > Records are not lvalues. Agreed, but they have identi

Dictionary question

2006-07-18 Thread Brian Elmegaard
Hi I have written the following which works, but I would like to write it less clumsy. I have a dictionary in which I loop through the keys for a dynamic programming algorithm. If a key is present I test if its value is better than the current, if it is not present I just create it. Would it be p

Re: question about what lamda does

2006-07-18 Thread nephish
ok, i think i get it. pretty cool. thanks -sk Dan Bishop wrote: > [EMAIL PROTECTED] wrote: > > Hey there, > > i have been learning python for the past few months, but i can seem to > > get what exactly a lamda is for. > > It defines a function. > > f = lambda x, y: expression > > is equivalent to

wanting

2006-07-18 Thread arsl89
hy gys i m wanting python programming language. plz snd me the backup of python -- http://mail.python.org/mailman/listinfo/python-list

Re: Capturing instant messages

2006-07-18 Thread Nick Vatamaniuc
Ed, It depends on what IM protocol the company is using. If there is more than one, your job might end up being quite complicated. You indicated port 5190 in your post, does it mean that the company is using only AOL IM? In general it seems like you would have to: 1) Capture the traffic 2) Decode

Re: question about what lamda does

2006-07-18 Thread Nick Vatamaniuc
Use it anywhere a quick definition of a function is needed that can be written as an expression. For example when a callback function is needed you could say: def callback(x,y): return x*y some_function(when_done_call_this=callback) But with lambda you could just write some_function(when_done_cal

Re: wanting

2006-07-18 Thread Paul Rubin
"arsl89" <[EMAIL PROTECTED]> writes: > hy gys i m wanting python programming language. > plz snd me the backup of python Me too. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary question

2006-07-18 Thread Brian Elmegaard
Brian Elmegaard <[EMAIL PROTECTED]> writes: At least it was clumsy to post a wrong example. This shows what = find clumsy. c=1 x=2 l=list() l.append(dict()) l[0][5]=0 l.append(dict()) for a, e in l[-2].iteritems(): # Can this be written better? if a+c in l[-1]: if l[-1][a+c

Re: win32com.client.Dispatch - understanding error messages

2006-07-18 Thread mirandacascade
Duncan Booth wrote: > wrote: > > Does using an absolute URL for the url parameter help any? You've specified > a relative URL (i.e. the folder 12.5.81.49 under the current location). I don't know the answer to that question. I know that when I'm on the same workstation and I copy/paste the string

Re: Coding style

2006-07-18 Thread Carl Banks
Bruno Desthuilliers wrote: > Carl Banks wrote: > > Patrick Maupin wrote: > > > >>PTY wrote: > >> > >> > >>>It looks like there are two crowds, terse and verbose. I thought terse > >>>is perl style and verbose is python style. BTW, lst = [] was not what > >>>I was interested in :-) I was asking

Re: range() is not the best way to check range?

2006-07-18 Thread John Machin
On 18/07/2006 7:22 PM, Paul Boddie wrote: > John Machin wrote: >> On 18/07/2006 12:41 PM, [EMAIL PROTECTED] wrote: >>> it seems that range() can be really slow: > > [...] > >> Some things to try: >> 1a. Read what the manual has to say about the range() function ... what >> does it produce? > > I

Re: Dictionary question

2006-07-18 Thread Nick Vatamaniuc
Brian, You can try the setdefault method of the dictionary. For a dictionary D the setdefault work like this: D.setdefault(k, defvalue). If k not in D then D[k] is set to defvalue and defvalue is returned. For example: In [1]: d={} In [2]: d.setdefault(1,5) Out[2]:5 In [3]: d Out[3]:{1: 5} In y

Re: win32com.client.Dispatch - understanding error messages

2006-07-18 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > Duncan Booth wrote: >> wrote: >> >> Does using an absolute URL for the url parameter help any? You've >> specified a relative URL (i.e. the folder 12.5.81.49 under the >> current location). > > I don't know the answer to that question. I know that when I'm on the > sa

Re: Recursive function returning a list

2006-07-18 Thread Boris Borcic
> Do you have any ideas? you could use a recursive generator, like def genAllChildren(self) : for child in self.children : yield child for childchild in child.genAllChildren() : yield childchild -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary question

2006-07-18 Thread Justin Azoff
Brian Elmegaard wrote: > for a, e in l[-2].iteritems(): > # Can this be written better? > if a+c in l[-1]: > if l[-1][a+c] l[-1][a+c]=x+e > else: > l[-1][a+c]=x+e > # I'd start with something like for a, e in l[-2].iteritems(): keytotal = a

Re: range() is not the best way to check range?

2006-07-18 Thread Paul Boddie
John Machin wrote: > > range() and xrange() are functions. You are suggesting that 2 > *functions* should acquire a __contains__ method each? I trust not. Well, range is a function in the current implementation, although its usage is similar to that one would get if it were a class, particularly a

Re: Capturing instant messages

2006-07-18 Thread Ed Leafe
On Jul 18, 2006, at 7:36 AM, Nick Vatamaniuc wrote: > It depends on what IM protocol the company is using. If there is more > than one, your job might end up being quite complicated. You indicated > port 5190 in your post, does it mean that the company is using only > AOL > IM? Yes, the

Re: Dictionary question

2006-07-18 Thread John Machin
On 18/07/2006 9:51 PM, Brian Elmegaard wrote: > Brian Elmegaard <[EMAIL PROTECTED]> writes: > > At least it was clumsy to post a wrong example. > This shows what = find clumsy. > > c=1 > x=2 > > l=list() > l.append(dict()) > l[0][5]=0 > > l.append(dict()) > > for a, e in l[-2].iteritems(): > #

Re: Python on RedHat AS 2.1?

2006-07-18 Thread Bill Scherer
Jeremy Winters wrote: > All the stuff I've found personally are security patches for python > 1.5.2... which seems to be baked into the OS. > > I don't choose to use this OS... it is mandated by our IT dept. I > have no complaints other than this... > > Is there nobody in pythonland who has ins

Re: wanting

2006-07-18 Thread Tim Chase
> "arsl89" <[EMAIL PROTECTED]> writes: >> hy gys i m wanting python programming language. >> plz snd me the backup of python > > Me too. LOL. U r0x0rz! cheCk ot tHiz sekret w4rez s1te!! http://www.python.org/download/ yul find ur "backup" of python hear. iF ur 133t nuf, u can axcessorz all

Re: range() is not the best way to check range?

2006-07-18 Thread Stefan Behnel
Andy Dingley wrote: > The purpose of range() in Python is as loop control, No, the purpose of range() is to create a list, as the docs state. http://docs.python.org/lib/built-in-funcs.html """ range(...) - This is a versatile function to create lists containing arithmetic progressions. """ Stef

Re: Python linker

2006-07-18 Thread Sion Arrowsmith
<[EMAIL PROTECTED]> wrote: >I love python - I use it as a utility language to complement my C# >programming every day. However, the reason I do not use it as my >primary language is - surprise, surprise - not its lack of static type >checking, but the size of standalone executes (which embed the

mkdir

2006-07-18 Thread westymatt
I have been looking around for a while, but I haven't seen many examples of os.mkdir() Anybody have any experience with it, is a since deprecated function? -- http://mail.python.org/mailman/listinfo/python-list

Re: mkdir

2006-07-18 Thread Simon Brunning
On 18 Jul 2006 05:45:48 -0700, westymatt <[EMAIL PROTECTED]> wrote: > I have been looking around for a while, but I haven't seen many > examples of os.mkdir() > Anybody have any experience with it, is a since deprecated function? Example here - - but it reall

Re: Python linker

2006-07-18 Thread Irmen de Jong
[EMAIL PROTECTED] wrote: > I love python - I use it as a utility language to complement my C# > programming every day. However, the reason I do not use it as my > primary language is - surprise, surprise - not its lack of static type > checking, but the size of standalone executes (which embed the

Re: wanting

2006-07-18 Thread Bruno Desthuilliers
arsl89 wrote: > hy gys i m wanting python programming language. > plz snd me the backup of python > Welcome to my bozo-list. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/l

Re: mkdir

2006-07-18 Thread westymatt
thanks a ton -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary question

2006-07-18 Thread Brian Elmegaard
John Machin <[EMAIL PROTECTED]> writes: > 2. Put spaces around operators -- in general, RTFStyleGuide >http://www.python.org/dev/peps/pep-0008 I din't know it. Thanks. > Only you know what *really* meaningful names you should be using. I have better names in my running code. > mykey = a +

Re: Dictionary question

2006-07-18 Thread Brian Elmegaard
"Justin Azoff" <[EMAIL PROTECTED]> writes: > last[keytotal] = min(last.get(keytotal), valtotal) > comes close to working - it would if you were doing max. Thanks, I think this would help. -- Brian (remove the sport for mail) http://www.et.web.mek.dtu.dk/Staff/be/be.html Rugbyklubben Speed Scan

Re: Dictionary question

2006-07-18 Thread Brian Elmegaard
"Nick Vatamaniuc" <[EMAIL PROTECTED]> writes: > if l[-1].setdefault(a+c, x+e) l[-1][a+c]=x+e Thanks for the answer. I will try it. -- Brian (remove the sport for mail) http://www.et.web.mek.dtu.dk/Staff/be/be.html Rugbyklubben Speed Scandinavian Open 7s Rugby http://www.rkspeed.dk -- http:

Has anyone used davlib by Greg Stein?

2006-07-18 Thread Joel Hedlund
Hi! I want to PUT files to a authenticated https WebDAV server from within a python script. Therefore I put "python dav" into google, and the davlib module by Greg Stein (and Guido?) came up. It seems to be soild but has very little docs. Has anyone worked with this? Is it any good? Where can I

Re: wanting

2006-07-18 Thread Steve Holden
Bruno Desthuilliers wrote: > arsl89 wrote: > >>hy gys i m wanting python programming language. >>plz snd me the backup of python >> > > Welcome to my bozo-list. > Note how the OP even abbreviates "arsehole" to "arsl" :-) regards Steve (to the original poster: sorry about all this humour at y

array alice of [:-0] ??

2006-07-18 Thread guthrie
Beginner question! :-) x=[1,2,3,4] for i in range(len(x)): print x[:-i] >>> [] >>> [1,2,3] >>> [1,2] >>> [1] 1) The x[:-0] result seems inconsistent to me; I get the idea that -0=0, so it is taken as x[:0] -> [] 2) how then should one do this basic left-recursive subsetting (easily)

Re: array alice of [:-0] ??

2006-07-18 Thread Boris Borcic
guthrie wrote: > Beginner question! :-) > > x=[1,2,3,4] > for i in range(len(x)): >print x[:-i] > > >>> [] > >>> [1,2,3] > >>> [1,2] > >>> [1] > > 1) The x[:-0] result seems inconsistent to me; > I get the idea that -0=0, so it is taken as x[:0] -> [] that's what you get. > 2) how

Re: array alice of [:-0] ??

2006-07-18 Thread John Machin
On 18/07/2006 11:17 PM, guthrie wrote: > Beginner question! :-) > > x=[1,2,3,4] > for i in range(len(x)): >print x[:-i] > > >>> [] > >>> [1,2,3] > >>> [1,2] > >>> [1] > > 1) The x[:-0] result seems inconsistent to me; > I get the idea that -0=0, so it is taken as x[:0] -> [] > 2) how

Re: array alice of [:-0] ??

2006-07-18 Thread Antoon Pardon
On 2006-07-18, guthrie <[EMAIL PROTECTED]> wrote: > Beginner question! :-) > > x=[1,2,3,4] > for i in range(len(x)): > print x[:-i] > > >>> [] > >>> [1,2,3] > >>> [1,2] > >>> [1] > > 1) The x[:-0] result seems inconsistent to me; > I get the idea that -0=0, so it is taken as x[:0] -> [] T

Re: Coding style

2006-07-18 Thread Bruno Desthuilliers
Carl Banks wrote: > Bruno Desthuilliers wrote: > >>Carl Banks wrote: >> >>>Patrick Maupin wrote: >>> >>> PTY wrote: >It looks like there are two crowds, terse and verbose. I thought terse >is perl style and verbose is python style. BTW, lst = [] was not what >I was

Re: Recursive function returning a list

2006-07-18 Thread Bruno Desthuilliers
Boris Borcic wrote: >> Do you have any ideas? > > > you could use a recursive generator, like > > def genAllChildren(self) : > for child in self.children : > yield child > for childchild in child.genAllChildren() : > yield childchild Or how to *not* address the

Re: Python linker

2006-07-18 Thread tac-tics
[EMAIL PROTECTED] wrote: > I love python - I use it as a utility language to complement my C# > programming every day. However, the reason I do not use it as my > primary language is - surprise, surprise - not its lack of static type > checking, but the size of standalone executes (which embed th

Re: wanting

2006-07-18 Thread Bruno Desthuilliers
Steve Holden wrote: > Bruno Desthuilliers wrote: > >> arsl89 wrote: >> >>> hy gys i m wanting python programming language. >>> plz snd me the backup of python >>> >> >> Welcome to my bozo-list. >> > Note how the OP even abbreviates "arsehole" to "arsl" :-) > > regards > Steve > > (to the origin

Re: wanting

2006-07-18 Thread placid
Steve Holden wrote: > Bruno Desthuilliers wrote: > > arsl89 wrote: > > > >>hy gys i m wanting python programming language. > >>plz snd me the backup of python this is one of my aims in life, to bloody understand this 1337 speak! --Cheers -- http://mail.python.org/mailman/listinfo/python-list

Howto Determine mimetype without the file name extension?

2006-07-18 Thread Phoe6
Hi all, I had a filesystem crash and when I retrieved the data back the files had random names without extension. I decided to write a script to determine the file extension and create a newfile with extension. --- method 1: # File extension utility. import os import mimetypes import shut

ScientificPython - LeastSquareFit diverges

2006-07-18 Thread Harold Fellermann
Dear all, I am trying to fit a powerlaw to a small dataset using Scientific.Functions.LeastSquares fit. Unfortunately, the algorithm seems to diverge and throws an OverflowException. Here is how I try it: >>> from Scientific.Functions.LeastSquares import leastSquaresFit >>> >>> data = [ ... (2

Re: Accessors in Python (getters and setters)

2006-07-18 Thread Bruno Desthuilliers
mystilleef wrote: > Bruno Desthuilliers wrote: > >>mystilleef wrote: >> >>>Gerhard Fiedler wrote: >>> >>> On 2006-07-15 06:55:14, mystilleef wrote: >In very well designed systems, the state of an object should only be >changed by the object. IMO that's not quite

Re: execute a shell script from a python script

2006-07-18 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Simon Forman <[EMAIL PROTECTED]> wrote: >spec wrote: >> Thanks, actually there are no args, is there something even simpler? >> >> Thanks >> Frank > >you could try os.system() > >>From the docs: > >system(command) . [more detai

Re: wanting

2006-07-18 Thread Patrick Bothe
placid wrote: > this is one of my aims in life, to bloody understand this 1337 speak! 100k h3r3, 8|2o: http://www.1337.net/ Regards, Patrick Ps: The translator might come in handy. -- 2 does not equal 3. Even for large values of 2. -- http://mail.python.org/mailman/listinfo/python-lis

Re: Coding style

2006-07-18 Thread Carl Banks
Bruno Desthuilliers wrote: > Carl Banks wrote: > > Iterables, lists, arrays, and whatever else have overlapping uses, but > > bool(obj) behaves differently for different types, > > bool(obj) will mainly look for __len__(), then for __nonzero__(), then > return True. You can only call len(obj) on o

Using Visual Slick Edit for Python

2006-07-18 Thread Brian Buderman
Anyone know if there is a way to make slickedit tag the built in modules such as os and sys so that code completion and the like work? -- http://mail.python.org/mailman/listinfo/python-list

rounding of a decimal object

2006-07-18 Thread Yuan HOng
How can I round a decimal object to desired decimal position? It seems you have to use some unintuitive expression like: Decimal('7.325').quantize(Decimal('.01')) why not simply use Decimal('7.325').round(2) or just round(Decimal('7.325'), 2)? -- Hong Yuan 大管家网上建材超市 装修装潢建材一站式购物 http://www.home

Re: Accessors in Python (getters and setters)

2006-07-18 Thread Bruno Desthuilliers
mystilleef wrote: > Bruno Desthuilliers wrote: > >>mystilleef wrote: >>Please don't top-post >> >>>On State and Behavior: >>> >>>To understand objects in terms of state and behavior you need to >>>absolve yourself from implementation details of languages >>>and think at an abstract level. >> >> >>

Re: embedding executable code in a regular expression in Python

2006-07-18 Thread Anthra Norell
Hi, see below ... - Original Message - From: "Paul McGuire" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: Sent: Monday, July 17, 2006 10:09 AM Subject: Re: embedding executable code in a regular expression in Python > Avi Kak wrote: > > Folks, > > > > Does regular expression proc

Re: question about what lamda does

2006-07-18 Thread nephish
so a lamda needs to stay at one expression, and use more than one lamda for more expressions ? i think i get it. sk Nick Vatamaniuc wrote: > Use it anywhere a quick definition of a function is needed that can be > written as an expression. For example when a callback function is > needed you cou

Re: Howto Determine mimetype without the file name extension?

2006-07-18 Thread Justin Azoff
Phoe6 wrote: > Hi all, > I had a filesystem crash and when I retrieved the data back > the files had random names without extension. I decided to write a > script to determine the file extension and create a newfile with > extension. [...] > but the problem with using file was it recognize

Re: Python linker

2006-07-18 Thread byteschreck
I develop shareware applications that need to be extremely slim (less than 1 MB is preferable). Delphi applications easily meet this requirement and I can expect end users to download the .NET framework (if they don't already have it!). However, I cannot expect users to download 3.5 MB. For corp

Re: Coding style

2006-07-18 Thread Bruno Desthuilliers
Carl Banks wrote: > Bruno Desthuilliers wrote: > >>Carl Banks wrote: >> >>>Iterables, lists, arrays, and whatever else have overlapping uses, but >>>bool(obj) behaves differently for different types, >> >>bool(obj) will mainly look for __len__(), then for __nonzero__(), then >>return True. You can

Re: range() is not the best way to check range?

2006-07-18 Thread Dan Bishop
Paul Boddie wrote: > Yes, he wants range to return an iterator, just like xrange more or > less does now. Given that xrange objects support __getitem__, unlike a > lot of other iterators (and, of course, generators), adding > __contains__ wouldn't be much of a hardship. Certainly, compared to > ot

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Jul 17)

2006-07-18 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Cameron Laird <[EMAIL PROTECTED]> wrote: . . . >John Machin illustrates the rudiments of embedding: > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/3189b10b83a

Re: Python linker

2006-07-18 Thread Simon Brunning
On 18 Jul 2006 08:01:22 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I develop shareware applications that need to be extremely slim (less > than 1 MB is preferable). > > Delphi applications easily meet this requirement and I can expect end > users to download the .NET framework (if they d

Re: array slice of [:-0] ??

2006-07-18 Thread guthrie
Thanks all!! - guthrie wrote: > Beginner question! :-) > > x=[1,2,3,4] > for i in range(len(x)): >print x[:-i] > > >>> [] > >>> [1,2,3] > >>> [1,2] > >>> [1] > > 1) The x[:-0] result seems inconsistent to me; > I get the idea that -0=0, so it is taken as x[:0] -

Re: unicode html

2006-07-18 Thread Duncan Booth
Sybren Stuvel wrote: > Duncan Booth enlightened us with: >> Don't bother using named entities. If you encode your unicode as >> ascii replacing all non-ascii characters with the xml entity >> reference then your pages will display fine whatever encoding is >> specified in the HTTP headers. > > W

  1   2   3   >