Re: [Tutor] Python 2.4 IDLE Windows 2000

2004-12-02 Thread Liam Clarke
>Yowza; that's some bug. Danny, do you happen to know the bug number? I >can't find it on sourceforge. It's been like that since 2.3 as far as I know. It generates a connection to localhost to run code in a separate environment. On Thu, 02 Dec 2004 07:20:19 -0700, Mike Hansen <[EMAIL PROTECTE

Re: [Tutor] Strange Appending

2004-12-02 Thread Liam Clarke
continue x.append(item) print x ['1','2','3','4','5','6'] But yeah, post up all the relevant code please, just not the bit that's not breaking. I can't see your loop that's writing the wrong values, or

Re: [Tutor] programming newbie question

2004-12-02 Thread Liam Clarke
IMAP / POP3 /SMTP connections/sessions as objects are very useful, as you can pass them from function to function. On Thu, 2 Dec 2004 21:50:20 -0500, Jacob S. <[EMAIL PROTECTED]> wrote: > > I am fairly new to programming and I have started to learn programming > > then stopped out of frustratio

Re: [Tutor] backup failed - gzip

2004-12-02 Thread Liam Clarke
As the below quote from the manual shows - On Windows, the return value is that returned by the system shell after running command, given by the Windows environment variable COMSPEC: on command.com systems (Windows 95, 98 and ME) this is always 0; on cmd.exe systems (Windows NT, 2000 and XP) this

Re: [Tutor] backup failed - gzip

2004-12-03 Thread Liam Clarke
iled." print returnCode, " is an unsuccessful return code." #if os.system(zip_command) == 0: #print 'Successful backup to', target #else: #print 'Backup FAILED' os.path.isfile(path) checks if there is a regular existing file there - i.e. target="c:/w

Re: [Tutor] gzip (fwd)

2004-12-03 Thread Liam Clarke
strftimeformatstring.zip No wonder it doesn't work. Try target=target_dir+'\\'+time.strftime('%Y%m%d%H%M%S') + '.zip' Regards, Liam Clarke PS Yes, do use reply to all On Fri, 3 Dec 2004 15:16:27 +0600, Ramkumar Parimal Alagan <[EMAIL PROTECTED]> wrote:

Re: [Tutor] Simple RPN calculator

2004-12-04 Thread Liam Clarke
RPN calculator, with operators and operands separate? Sounds counter-intuitive to me. What's the advantage I'm missing? P.S. Nice Shodan quote Max ;) On Sat, 4 Dec 2004 23:45:18 +, Max Noel <[EMAIL PROTECTED]> wrote: > > > > On Dec 4, 2004, at 23:30, Alan Gauld wrote: > > >> to make it

Re: [Tutor] Real time reading

2004-12-05 Thread Liam Clarke
lib/module-StringIO.html ??? Good luck, Liam Clarke On Sun, 5 Dec 2004 11:31:32 +0100 (CET), Øyvind <[EMAIL PROTECTED]> wrote: > I would like to analyze a maillog. The maillog is automatically generated > and every mail sent is added to the log. I would like to check if someone &g

Re: [Tutor] Simple RPN calculator

2004-12-05 Thread Liam Clarke
My head boggles. This is like trying to understand game theory. On Sun, 05 Dec 2004 11:40:38 -0500, Brian van den Broek <[EMAIL PROTECTED]> wrote: > Kent Johnson said unto the world upon 2004-12-05 06:55: > > RPN reverses the order of operator and operand, it doesn't reverse the > > whole string.

Re: [Tutor] Could I have used time or datetime modules here?

2004-12-05 Thread Liam Clarke
no interpreter so I can't check this out. So yeah, that's a couple of different ways I'd do it using datetime, but someone else will no doubt do it better and simpler. HTH Liam Clarke ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] gzip (fwd)

2004-12-05 Thread Liam Clarke
gt; > > No wonder it doesn't work. > > > > Try > > > > target=target_dir+'\\'+time.strftime('%Y%m%d%H%M%S') + '.zip' > > Instead of doing this, use os.path.join to make it more platform > independent. > > target = os.p

Re: [Tutor] CGI Video collection application File I/O troubles

2004-12-05 Thread Liam Clarke
ame,'w') except TypeError: print "the error is occurring on opening the file, which would mean that it's variable filename which is causing the problem." try: f.write(x) except TypeError: print "The error is occurring on writing to the file, which means the writ

Re:[Tutor] Address book sort of

2004-12-05 Thread Liam Clarke
Oops I've got my own wee dictionary reader, writers. Very simple - So, you have a user Dave, who has a dictionary of {'address':'21 jump St', 'Number: 'One, the loneliest.'} So, you create a dictionary of dictionaries -myDict = {'Dave' : {'address':'21 jump St', 'Number: 'One, the loneliest.'}

Re: [Tutor] Could I have used time or datetime modules here?

2004-12-05 Thread Liam Clarke
Best thing in Python, I reckon, is an interpreter to check out your code. I find it hard to answer queries in this list when I don't have Pythonwin open to check what I'm suggesting works! On Mon, 6 Dec 2004 18:27:49 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > Ah, n

Re: [Tutor] Address book sort of

2004-12-05 Thread Liam Clarke
d his email. Which should equal nicely laid out. Haven't tested this though... Standard disclaimer - There's probably an easier way to do it, and a more elegant way. Which someone will post shortly. Cheers, Liam Clarke On Mon, 6 Dec 2004 07:55:11 +0300 (Arab Standard Time), Eri Me

Re: [Tutor] Address book sort of

2004-12-05 Thread Liam Clarke
Just tested the setout thing. It works. Prolly a hack, but it works. On Mon, 6 Dec 2004 19:05:58 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > [quote] > > > if select == '1' or select == 'v' or select == 'V': > if file_i

Re: [Tutor] psyco 1.3 is out, with support for Python 2.4

2004-12-06 Thread Liam Clarke
Have you used Pysco much Dick? Is it n00bie friendly? Or, to put it another way, at what point in a programme's size/speed does it become worthwhile to implement Pysco? Regards, Liam Clarke On Sun, 05 Dec 2004 23:49:03 -0800, Dick Moores <[EMAIL PROTECTED]> wro

[Tutor] Re: Could I have used time or datetime modules here?

2004-12-06 Thread Liam Clarke
, 7, 8, 51, 00) later= datetime.datetime(2004, 12, 8, 3, 45, 00) difference = later - now timeList=str(difference).split(":") timeinSecs=(int(timeList[0])*3600)+(int(timeList[1])*60)+int(timeList[2]) And that's the easier way to find the difference between two times in seconds. HT

Re: [Tutor] Finding a part of an element in a list

2004-12-06 Thread Liam Clarke
ent2 in element1: #Do something here, usually a break or continue clause (Incidentally,'for element in list' is an easier version of for i in range(len(list)) when you don't need to use index numbers. It just steps element by element.) 'if x in y' works for s

Re: [Tutor] Python 2.3.5 out in January??

2004-12-07 Thread Liam Clarke
Sometimes I suspect XP is the latest 3.11 beta. ;) On Tue, 07 Dec 2004 01:41:05 -0800, Dick Moores <[EMAIL PROTECTED]> wrote: > Just saw this on comp.lang.python.announce. > > > I don't understand this. Why is a new version of 2.3 being worked on > after 2.4 has been r

[Tutor] String matching?

2004-12-07 Thread Liam Clarke
Hi all, I have a large amount of HTML that a previous person has liberally sprinkled a huge amount of applets through, instead of html links, which kills my browser to open. So, want to go through and replace all applets with nice simple links, and want to use Python to find the applet, extract

Re: [Tutor] Re: Could I have used time or datetime modules here?

2004-12-07 Thread Liam Clarke
me.time(): But Occam's Razor works better. >Brian, where did you learn about the ".seconds". And the .year, .month, >.day of What's funny, is that after I'd gone to bed that night, I suddenly woke up and thought "Hang on, what about the attribute .seconds of a d

Re: [Tutor] Re: Could I have used time or datetime modules here?

2004-12-07 Thread Liam Clarke
's Razor works better. > > >Brian, where did you learn about the ".seconds". And the .year, .month, > >.day of > > What's funny, is that after I'd gone to bed that night, I suddenly > woke up and thought "Hang on, what about the attribute .seconds o

Re: [Tutor] String matching?

2004-12-07 Thread Liam Clarke
nks, Kent, for some reason I totally missed that. And thanks for the re, hopefully I won't have to use it, but it gives me a starting point to poke the re module from. Regards, Liam Clarke On Tue, 07 Dec 2004 09:03:45 -0500, orbitz <[EMAIL PROTECTED]> wrote: > Instead of copying and pa

Re: [Tutor] Printing two elements in a list

2004-12-07 Thread Liam Clarke
aList=['c','d'] element = 1 del aList[1] aList=['c'] element = 2 del aList[2] IndexError - value out of range. Whereas - aList=['b','c','d'] indexes=[0,1,2] indexes.reverse() for element in indexes: del aList[element] elem

Re: [Tutor] Re: Could I have used time or datetime modules here?

2004-12-07 Thread Liam Clarke
>alarm_datetime = datetime.datetime(now.year, now.month, now.day, alarm_hour, alarm_minute) Now that's clever. I too, have learnt a large amount from this thread. On Tue, 07 Dec 2004 23:57:59 -0500, Brian van den Broek <[EMAIL PROTECTED]> wrote: > Dick Moores

[Tutor] MemoryError

2004-12-08 Thread Liam Clarke
lly appreciated. I don't want to to have to learn C++? Malloc has an evil reputation. Oh, and Python 2.3.4, Windows XP Pro SP1, Athlon 650MHz, 256Mb RAM 20Gb HD, which has 1.6Gb free. In case any of that infos relevant. : ) Regards Liam Clarke -- 'There is only one basic human right, a

Re: [Tutor] MemoryError

2004-12-08 Thread Liam Clarke
Oh, and I never knew about .read() for a file object. I always just used readline/readlines. Silly, really. On Thu, 9 Dec 2004 11:31:40 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > > I'm not sure why you're getting the MemoryError, but it'd be easier to >

Re: [Tutor] MemoryError

2004-12-08 Thread Liam Clarke
roughout as suggested, and wrap it in a function for that optimization Jeff mentioned. Thanks for the advice, I'll let you know how it goes. Regards, Liam Clarke I didn't think to On Wed, 08 Dec 2004 12:29:10 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote: > Liam Clarke wro

Re: [Tutor] Re: Could I have used time or datetime modules here?

2004-12-09 Thread Liam Clarke
/results/qur2Pw95.html It works on the cmd line - python alarm.py 17:30 Sets the alarm for the next occurrence of 17:30, using nothing but datetime.datetime objects, and one timedelta (maybe). 'Twas a good discussion. : ) Liam Clarke On Thu, 09 Dec 2004 00:12:04 -0500, Brian van den

Re: [Tutor] MemoryError

2004-12-09 Thread Liam Clarke
ach. It can't be any more unwieldy and ugly than what I've got going at the moment. Thanks for all the help, I'm off to get myself another problem. Regards, Liam Clarke On Wed, 08 Dec 2004 15:25:30 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote: > Liam Clarke wrote: > >

Re: [Tutor] String matching?

2004-12-09 Thread Liam Clarke
x27;s good. Got to say, that re is very powerful, but that redemo.py you recommended is brilliant for a beginner. I just wrote my re pattern in there, and used it to troubleshoot. So yeah, thanks again. Regards, Liam Clarke On Tue, 07 Dec 2004 21:06:34 -0500, Kent Johnson <[EMAIL PROT

Re: [Tutor] MemoryError

2004-12-09 Thread Liam Clarke
st.reverse() for ((start, end), href) in appList: codeSt=codeSt.replace(codeSt[start:end], href) Of course, that's just a rought draft, but it seems a whole lot simpler to me. S'pose code needs a modicum of planning. Oh, and I d/led BeautifulSoup, but I couldn't work it right,

Re: [Tutor] Capturing Logfile data in Windows

2004-12-09 Thread Liam Clarke
urTime: curTime = os.path.getmtime('log.txt') x=file('log.txt','r')... So basically, just check the modification time. If the modification time has changed, then the file's been updated. It's one way to do it. : ) Liam Clarke On Thu, 09 Dec 2004 1

Re: [Tutor] MemoryError

2004-12-10 Thread Liam Clarke
for the help, especially that sub method. Regards, Liam Clarke On Thu, 09 Dec 2004 19:38:12 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Liam, > > Here's a nifty re trick for you. The sub() method can take a function as the > replacement parameter. > Instead of rep

Re: [Tutor] Re: Could I have used time or datetime modules here?

2004-12-10 Thread Liam Clarke
level- > from pygame.base import * > ImportError: Module use of python23.dll conflicts with this version of > Python. As far as I know, you'll either have to - run Python 2.3 or - run Python 2.3 until they release a new version of Pygame, Tutors? Regards, Liam Clarke On Fri, 10 Dec

Re: [Tutor] using a function as a dictionary value?

2004-12-13 Thread Liam Clarke
lled 'dude()' you could probably call it as a dictionary of 'dude' from the namespace... Standard disclaimer - Someone more knowledgable would probably be along shortly to point out a simpler, elegant way to do it, but my way works. Mostly. HTH Liam Clarke > #

Re: [Tutor] Difference between for i in range(len(object)) andfor i in object

2004-12-13 Thread Liam Clarke
Browse/Threaded/python-Tutor A searchable archive of the Tutor group http://www.ibiblio.org/obp/thinkCSpy/index.htm A good tutorial on writing code, which happens to use Python Good luck, Liam Clarke On Sun, 12 Dec 2004 09:31:15 -0700, Bob Gailer <[EMAIL PROTECTED]> wrote: > At 08:27 AM 12

Re: [Tutor] Opening and reading .cvs files in Python

2004-12-14 Thread Liam Clarke
That's a very broad question. You could email it to yourself, check out the IMAP, POP3, SMTP modules. Alternatively, you could create an FTP session. Check out ftplib. Once you've got it you can use the CSV module to read & parse it. Have fun. Liam Clarke, On Tue, 14 Dec 2004

Re: [Tutor] check_range

2004-12-15 Thread Liam Clarke
milar intepreter, and test it! I'd call that another strength of Python. Liam Clarke On Wed, 15 Dec 2004 07:43:57 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Brian van den Broek wrote: > > DogWalker said unto the world upon 2004-12-15 00:32: > > > >> "Bri

Re: [Tutor] am I missing another simpler structure?

2004-12-15 Thread Liam Clarke
I find multiple returns to be rather useful - def isOdd(x): if not x % 2: return False return True On Thu, 16 Dec 2004 01:06:58 -0500, Brian van den Broek <[EMAIL PROTECTED]> wrote: > [Brian van den Broek] > > complicated with:> > > >>import datetime > >>def is_leap_year(year): > >>'''

Re: [Tutor] am I missing another simpler structure?

2004-12-15 Thread Liam Clarke
Alright, so that was a quick example, but >return not x % 2 A light dawns. On Thu, 16 Dec 2004 15:58:38 +0900, Guillermo Fernandez Castellanos <[EMAIL PROTECTED]> wrote: > Well... > > > I find multiple returns to be rather useful > > def isOdd(x): > > if not x % 2: return False > >

[Tutor] A simpler mousetrap

2004-12-16 Thread Liam Clarke
tc/arc/gab.pct" aList=a.split('.') aList[-1]='bak' a=".".join(aList) but I'm wondering if there's a simpler way, as there usually seems to be, and it's always so obvious once I'm shown it, like 6 down - Six on vehicle live in the manse (VI +

Re: [Tutor] Re: A simpler mousetrap

2004-12-16 Thread Liam Clarke
x=os.path.splitext(a)[0]+'.bak' Ah, jolly good, looks a bit simpler. Thanks! Regards, Liam Clarke On Thu, 16 Dec 2004 09:44:03 +0100, Wolfram Kraus <[EMAIL PROTECTED]> wrote: > Liam Clarke wrote: > > Hi all, > > > > I'm writing some code, and I

Re: [Tutor] MemoryError

2004-12-10 Thread Liam Clarke
as a way to avoid cutting & pasting, ended up as a pursuit of knowledge. Oh well. Thanks to all for the assistance. Regards, Liam Clarke On Fri, 10 Dec 2004 07:50:25 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Well, that's a regex only a mother could love. :-) I can see why

Re: [Tutor] check_range

2004-12-14 Thread Liam Clarke
t('s') will raise an error, TypeError, hence the try/except/else error catching clauses. It'll look like this when running - Enter number here David Please enter a number only Enter number here Henry Please enter a number only Enter number here 1.0111010010101010 Thanks You enter

Re: [Tutor] Re: tempfile

2004-12-23 Thread Liam Clarke
fileObj=... fileObj.seek()? Is what I use, although that's for specific byte positions I believe. On Fri, 24 Dec 2004 03:09:31 +0430, Lee Harr <[EMAIL PROTECTED]> wrote: > >I'm using tempfile. The doc says it is opened 'w+b' so that it can be > >read and written without closing and reopening. >

Re: [Tutor] O.T.

2004-12-28 Thread Liam Clarke
I'm 23, married, 3 month old son, employed in New Zealand's social welfare department, in a totally non IT role, learning Python purely out of personal interest and a desire to stop working for New Zealand's social welfare department someday. I too climb mountains, having previously been based in

[Tutor] Array pointers

2005-01-04 Thread Liam Clarke
ck of the ideas folder for when I've (if ever) learn Cpp? Regards, Liam Clarke PS -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the consequences. _

Re: [Tutor] Array pointers

2005-01-04 Thread Liam Clarke
g to think I'm going to have to go Cpp for this kind of direct pixel tweaking stuff. (640x480 (let alone 1024x768) is a lot of pixels to run through a for... loop) So yeah, anyone had this before? Regards, Liam Clarke On Tue, 4 Jan 2005 22:36:55 -0500, Byron Saltysiak <[EMAIL PROTECTED]&g

Re: [Tutor] regex problem

2005-01-04 Thread Liam Clarke
for (low, high) in ranges: stringStuff.replace[stringStuff[low:high], space] HTH Liam Clarke On Tue, 4 Jan 2005 15:39:18 -0800, Michael Powe <[EMAIL PROTECTED]> wrote: > Hello, > > I'm having erratic results with a regex. I'm hoping someone can > pinpoint the

Re: [Tutor] Input to python executable code and design question

2005-01-09 Thread Liam Clarke
Eep. On Mon, 10 Jan 2005 13:04:33 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > I think you're looking for eval() - but that's a big security hole, > and wouldn't handle f(x) notation overly well, unless you parse like > John said. > > > On Mon, 10

[Tutor] Slightly OT - Python/Java

2005-01-09 Thread Liam Clarke
te it in Python, and it gives me that 27 minutes of not messing about counting my braces, I'm in heaven. ( I actually wrote a Python script to count braces.) Anyone familar? Regards, Liam Clarke PS I'm only learning Java because it's what they teach the COSC 1st year course th

Re: [Tutor] Slightly OT - Python/Java

2005-01-09 Thread Liam Clarke
have the Intel assembler manuals at home, haven't even looked at 'em. If we're going for speed... Ah pity. I was hoping I could code for the JVM in Python style; I'd have to learn Java anyway, but I was thinking long, long term, beyond my public service walls. Regards, Liam Clar

Re: [Tutor] Slightly OT - Python/Java

2005-01-10 Thread Liam Clarke
tation & editors. For the mo, it's all Notepad. Ick. Alan Gauld wrote: >Actually modern C compilers usually mean that well written C >can outperform even assembler, to write good assembler is just >so hard that very few people can outsmart a good comiler... Good to hear, means I c

Re: [Tutor] More and more OT - Python/Java

2005-01-11 Thread Liam Clarke
n00bie in Python, Java, Jscript and HTML, so I don't see the real indepth stuff) is MSN Messenger for it's logs. And MS IE can parse that XML. I've been curious as to how it's implemented. So yeah, if you want to share your experiences. Regards, Liam Clarke On Tue, 11 Jan

Re: [Tutor] Time script help sought!

2005-01-11 Thread Liam Clarke
t can't use strftime) which you can then use to format your time with strftime! Real easy... if there's anything I've messed up, let me know, and I'll clarify it for you ( I coded something similar at home). Or if anything needs expansion upon... Regards, Liam Clarke On Tu

Re: [Tutor] More and more OT - Python/Java

2005-01-11 Thread Liam Clarke
t XML & XSL? PS What's SAX DOM? I know what a DOM is, but what's the SAX? I saw it in my Python docs when I was poking XMLParser. If/when I work with XML, would you recommend Python's standard modules for it? Regards, Liam Clarke On Tue, 11 Jan 2005 23:34:30 +, Max Noel &

Re: [Tutor] Time script help sought!

2005-01-12 Thread Liam Clarke
t work.) Never post untested code Liam Clarke On Wed, 12 Jan 2005 10:08:02 -0500, kevin parks <[EMAIL PROTECTED]> wrote: > thanks everyone... I will look at all the various appraoches folks came > up with and see what i can learnn from them. I ended doing something > lame -- a b

Re: [Tutor] Time script help sought!

2005-01-12 Thread Liam Clarke
And I just noticed an error in my correction code! if len(splitLine) = 5 should be - if len(splitLine) == 6 Gah On Thu, 13 Jan 2005 11:48:03 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > I'm real sorry. > > My standard disclaimer is now amended to include - "

Re: [Tutor] More and more OT - Python/Java

2005-01-12 Thread Liam Clarke
XML, XPath, XML Schema all have basic tutorials at www.w3schools.org Out of curiosity, how does a node function in a DOM? I'm not very good at manipulating DOM's, I can do the basics, mainly by passing object IDs to JS functions, which feels like cheating. On Wed, 12 Jan 2005 07:57:02 -0500, K

[Tutor] List comprehensions

2005-01-12 Thread Liam Clarke
Hi, Am I able to achieve something like this - def foobar(); # stuff return x=[1,1000] for j=foobar(item) for item in x: As a comprehension, if you get what I mean... Can I build a for loop with a function in for x in x part? Ack. Having difficulty summing it up properly. -- 'There

Re: [Tutor] List comprehensions

2005-01-12 Thread Liam Clarke
Aah, thank you both - I knew there was a way to do it. Regards, Liam Clarke PS John - another Kiwi, seems to be a lot of NZers involved in Python & Python projects. Is it the No. 8 wire freedom of Python? ; ) On Wed, 12 Jan 2005 18:48:39 -0500, Kent Johnson <[EMAIL PROTECTED]> w

Re: [Tutor] Is Tkinter the Gui in python

2005-01-12 Thread Liam Clarke
I believe Tkinter + Tix come with your Python install. wxPython is another popular GUI, but it is 3rd party. On Wed, 12 Jan 2005 19:11:06 -, Alan Gauld <[EMAIL PROTECTED]> wrote: > > Is the standard Tkinter module in python does the GUI - Front -end > > Interface for Python > > Its the libr

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Liam Clarke
[lineIndex].startswith("Name="): probe_pairs[lineIndex]='' On Fri, 14 Jan 2005 09:38:17 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > > >>> name1 = '[N][a][m][e][=]' > > >>> for i in range(len(probe_pairs)):

Re: [Tutor] Re: Is Tkinter the Gui in python

2005-01-13 Thread Liam Clarke
On Fri, 14 Jan 2005 09:51:48 +0900, Guillermo Fernandez Castellanos <[EMAIL PROTECTED]> wrote: > > > So tkinter is a good module to use if you only want simple widgets, > > > but be prepared to switch to something newer when you hit it's > > limitations. > > This I agree with totally, fortunately I

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Liam Clarke
- > I just wanted to point out that files have been > iterators for a few versions now and that is being used more and more. It > also saves the memory problem of using big files > and reading them all at once with readlines. > > Jacob > > > Liam Clarke wrote: > &

Re: [Tutor] Posting a large amount of code?

2005-01-16 Thread Liam Clarke
http://www.rafb.net/paste/ is good for when you need to make your code accessible - best of all it formats the code for you. Just copy & paste your code, and distribute the link it gives you. Your 'pasted' code expires after 24 hours though. Regards, Liam Clarke On Sun, 16 Jan

[Tutor] Setting the focus to a window

2005-01-16 Thread Liam Clarke
Oops, to the list also. -- Forwarded message -- From: Liam Clarke <[EMAIL PROTECTED]> Date: Mon, 17 Jan 2005 09:49:48 +1300 Subject: Re: [Tutor] Setting the focus to a window To: Orri Ganel <[EMAIL PROTECTED]> Hi Orri, What Alan said earlier in the topic. You wan

[Tutor] Objects, persistence & getting

2005-01-16 Thread Liam Clarke
ethod bar in module b.py access foo without foo being passed directly to bar? Does that make sense? So, foo is floating around in the namespace, and bar just wants to grab a field of foo. Can it? I had a poke around the namespace yesterday, and got lost in hordes of methods that look like __thi

Re: [Tutor] Objects, persistence & getting

2005-01-17 Thread Liam Clarke
Law of Demeter? And, OK I'll just pass references, it was a passing idle thought. But thanks : ) What kind of languages espouse real OOP? Smalltalk gets mentioned a lot. Ruby? Regards, Liam Clarke On Mon, 17 Jan 2005 07:48:28 -, Alan Gauld <[EMAIL PROTECTED]> wrote: &g

Re: [Tutor] need advice on streamlining code...

2005-01-17 Thread Liam Clarke
j=re.compile(pattern, IGNORECASE) jay = os.popen("grep ifconfig_fxp0 /etc/rc.conf").readlines() matches=reObj.search(jay[0]) ip = matches.group('ip') netmask =matches.group('mask') #You can then do your string splits, whatever now. HTH Liam Clarke regExs, ca

Re: [Tutor] need advice on streamlining code...

2005-01-17 Thread Liam Clarke
yeah, I wasn't sure about that readline/lines thing, cos I'm not sure how popen works. On Mon, 17 Jan 2005 21:38:37 -0500, Jacob S. <[EMAIL PROTECTED]> wrote: > I seem to always be the one to suggest this, but -- > > "String methods are better than using the string module because the string > mo

Re: [Tutor] Objects & Classes...

2005-01-17 Thread Liam Clarke
Curious - what's mod_python? On Tue, 18 Jan 2005 03:10:44 +, Max Noel <[EMAIL PROTECTED]> wrote: > > On Jan 18, 2005, at 02:59, Jack Cruzan wrote: > > > Wouldn't it though! I haven't checked but doesn't he use xml for his > > equipment lists - if that was the case it would be worth it to as

Re: [Tutor] Fw: Please submit to tutor list: dictionary update prob

2005-01-19 Thread Liam Clarke
update_dict(data_holder, filename) >else: # file no exist >write_book(data_holder, filename) >break >else: >d.clear() #clear dict >break There's two elses, but no inital if: There's a plac

Re: [Tutor] Unexpected result from decimal

2005-01-19 Thread Liam Clarke
Jacob- one slight flaw/quirk in Python is if you want floating point computations you have to specify a floating point. >>> import decimal >>> decimal.getcontext().prec = 2 >>> a = decimal.Decimal(2) >>> b = decimal.Decimal(3) >>> 100*a/b Decimal("67") >>> print 100*a/b try - a=decimal.Decimal

Re: [Tutor] counting no of words

2005-01-20 Thread Liam Clarke
I'd take the easy way out and use winPython's COM objects to open the doc in word, and save it as .txt and then - f=file("doc.txt",'r') j=f.read() j=j.split(" ") print len(j) On Thu, 20 Jan 2005 13:59:16 -0500, Roger Merchberger <[EMAIL PROTECTED]> wrote: > Rumor has it that Bill Mill may have

[Tutor] Syntactical question / OT Lisp

2005-01-20 Thread Liam Clarke
ction parrot.Sketch() to access that config dictionary, I would reference it as foo.app.config? Is that right? Regards, Liam Clarke -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the co

[Tutor] Ooer, OT Lisp

2005-01-20 Thread Liam Clarke
syntaxless' language can write programmes? Sorry to play 20 questions. Regards, Liam Clarke -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the consequences.

Re: [Tutor] Print record x in a file

2005-01-23 Thread Liam Clarke
Don't you mean x=random.randint(0, lenoflist) ?? I'm assuming you want an integer. On Sun, 23 Jan 2005 21:55:27 + (GMT), David Holland <[EMAIL PROTECTED]> wrote: > --- [EMAIL PROTECTED] wrote: > > Send Tutor mailing list submissions to > > tutor@python.org > > > > To subscribe or unsubscr

Re: [Tutor] Convert string to variable name

2005-01-27 Thread Liam Clarke
I've used something along the lines for Pythoncard, but the names are generated within strict rules and expectations. i.e. first off â #Some code that uses regExs, finds all headings, and # a asterisk to indicate a date value, returns a iterable object reHead using finditer() #which contai

Fwd: [Tutor] Control flow

2005-01-29 Thread Liam Clarke
ng if the weather is bad? Unless I've got input() wrong, it only takes integers... ? Regards, Liam Clarke -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the consequences. -- 'There is only o

Re: [Tutor] Naming conventions (was: Should this be a list comprehension or something?

2005-01-29 Thread Liam Clarke
o I don't use them for that reason as well. Liam Clarke On Fri, 28 Jan 2005 22:54:08 -0500, Jacob S. <[EMAIL PROTECTED]> wrote: > You're my best friend. Everyone else looves camelCase, and I hate it too. It > doesn't make sense. It doesn't fit English. > It d

Re: [Tutor] Naming conventions (was: Should this be a list comprehension or something?

2005-01-29 Thread Liam Clarke
ykindofbreakatall > > thatshouldannoyeveryoneequally > > Kent > > Liam Clarke wrote: > > Just please_don't_use_underscores. > > > > They_make_my_eyes_go_funny_, _and_code_hard_to_read_in_my_opinion. > > > > _u_n_d_e_r_s_c_o_r_e_s_ _a_r_e__u_g_l_y_ > > > &g

Re: [Tutor] files in a directory

2005-01-30 Thread Liam Clarke
dirs. Standard disclaimer - prolly is a better, cleaner, simpler way to do it. But, this way works. And it's better (imao) than redirecting stdin all the time. Regards, Liam Clarke On Sun, 30 Jan 2005 00:03:18 -0800 (PST), kumar s <[EMAIL PROTECTED]> wrote: > Hello. > > I w

[Tutor] Ports / sockets?

2005-01-30 Thread Liam Clarke
s? Or, do programmes create sockets which can utilise ports? If so, can you access a port directly in Python? I always wanted to be able to the nitty gritty stuff like accessing a particular port, but I always thought I'd have to learn Cpp to do it. Regards, Liam Clarke -- 'There is onl

Re: [Tutor] How to sum rows and columns of a matrix?

2005-01-31 Thread Liam Clarke
There's a specific package for arrays http://www.stsci.edu/resources/software_hardware/numarray that implements array mathematics. I use it for pixel map manipulation in pygame, so it's relatively fast. On Mon, 31 Jan 2005 19:09:59 +0100, Gregor Lingl <[EMAIL PROTECTED]> wrote: > Hi all of you

Re: [Tutor] Better structure?

2005-02-01 Thread Liam Clarke
> http://www.cs.bell-labs.com/cm/cs/pearls/ That link seems to be dead. Pity. My whole programming experience is comprised of Ah-Ha's followed by Um's... -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to tak

Re: [Tutor] Presentation

2005-02-02 Thread Liam Clarke
eye twice in 5 seconds. Remember, there's more than one way to do it!) Regards, Liam Clarke On Wed, 2 Feb 2005 00:59:44 -0800 (PST), Danny Yoo <[EMAIL PROTECTED]> wrote: > > > > The community is one of the things I particularly like about Python. I > > always ha

Re: [Tutor] Better structure?

2005-02-02 Thread Liam Clarke
ux and you can't play your DirectX capable games, should Linux support DirectX just for you, or should you install Windows? Don't mean to sound too censorious, but the Python library is fantastic, and it's free. It's got some twists, but it's mostly documented and usua

[Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-02 Thread Liam Clarke
Hi, Had the *ahem* joy of learning Perl last night. Egad. Wrote the script in Python to get it right, and then 'translated' it to Perl. Does the style of coding Python engenders suit the Perl environment in anyone's experienc? AFAI can see there is no real 'style' to Perl, apart from white noise

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-02 Thread Liam Clarke
g *nix users to sign a Microsoft EULA!! (Well, not as bad, but still as anathemic.) >Fast forward to last summer. In the span of 1 week, I discovered both Python and Ruby. Fell in love with both and immediately ditched Perl. How's Ruby? I bookmarked the homepage, but never got around to l

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-03 Thread Liam Clarke
>I suppose that one might argue that I *still* just don't really get >lambdas (and I wouldn't argue with that). I can see some advantages >to small inline functions, though I suspect that a more-explicit >currying mechanism (such as the proposed partial() higher-order >function) could easily repla

Re: [Tutor] Better structure?

2005-02-03 Thread Liam Clarke
Alan said - > Its bad practice to delete a member in the collection being iterated > but Python copes OK if you just change the current item. Yeah, that's very bad. Makes for all sorts of subtle errors. I usually do the iteration as a for i in range(len(someList) type thing, and collect the indexe

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-04 Thread Liam Clarke
I had a problem with nested while 1: ... . ... ... break blocks. So, I got some sleep, fixed it, and now do everything in my power to not nest while 1 - break blocks. Not that it's really relevant. On Fri, 4 Feb 2005 17:18:49 -0500, Smith, Jeff <[EMAIL PROTECTED]> wrote: > Please d

Re: [Tutor] Hex to Str - still an open issue

2005-02-05 Thread Liam Clarke
only does base 10 to base 2. Should I include a base 6 to base 2, base 8 to base 2, base 10 to 6, 10 to 8, 8 to 6? I wouldn't like to write for the standard library, because you can never please everyone. But yeah, feel free to use the above, just keep my doc strings and comments. Regards,

Re: [Tutor] Hex to Str - still an open issue

2005-02-05 Thread Liam Clarke
a larger odd number would do it, but no. i = 320977545 s = 1001100111011101010001001 Chuck that into ol' calc, and I get, 320977545. Can anyone shed some more light on this? Regards, Liam Clarke On Sat, 05 Feb 2005 10:48:01 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: &g

Re: [Tutor] Re: variation of Unique items question

2005-02-05 Thread Liam Clarke
out of you â I have better things to do. Q: How can I crack root/steal channel-ops privileges/read someone's email? A: You're a lowlife for wanting to do such things and a moron for asking a hacker to help you." Arrogant words of wisdom to ask help by. :- ) (But, some of

Re: [Tutor] Hex to Str - still an open issue

2005-02-06 Thread Liam Clarke
h, if I'd known I wanted to use maths for something I enjoyed, I would've paid attention in class. But the remainder thing - would this be why we read binary the way we do? 4 is 001 (on a continuum of 2^0 to 2^n), but using the above approach we get 100. Regards, Liam Clarke On Sun, 6

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-06 Thread Liam Clarke
Even more OT it would seem, but harking back to the original subject, Perl isn't looking too bad because I've been working through Java tonight. $j = ; is relatively intuitive for a child of Unix, and it's also documented. BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.

  1   2   3   4   5   >