Re: [Tutor] Translating FORTRAN (77?) to Python?

2009-01-16 Thread Smith, Jeff
There was an add-on to the GNU C compiler for FORTRAN77 at one time (g77). I don't know if it is still available to how well it works though. Jeff From: tutor-bounces+jsmith=medplus@python.org [mailto:tutor-bounces+jsmith=medplus@python.org] On Behalf

Re: [Tutor] or synxtax in if statement

2007-08-31 Thread Smith, Jeff
That definitely won't work. How could the language possibly determine if you meant a == b | a == c as opposed to the literal a == b | c What this becomes is a == (b | c) Also be aware that | is a "bitwise or" and not a logical "or" which may not be what you want. So your original expressio

Re: [Tutor] Losing the expressivenessofC'sfor-statement?/RESENDwithexample

2007-08-10 Thread Smith, Jeff
That's a good point. He keeps indicating that the tutorial should make reference to C/C++/Java syntax specifically because that's what the rest of the known universe uses. To carry your example one step farther, it's like expecting a grade school Spanish text to have pointers for English speaker

Re: [Tutor] Losing the expressivenessofC'sfor-statement?/RESENDwith example

2007-08-10 Thread Smith, Jeff
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stephen McInerney > I didn't get much decent opinion on my central question: > "isn't this idiom more restrictive than C/C++/Java (aka the rest of the universe)," I thought you got plenty of decent opinion and most of was disagreement.

Re: [Tutor] Losing the expressiveness ofC'sfor-statement?/RESENDwith example

2007-08-10 Thread Smith, Jeff
Thank you for reminding me of that! I've just started with 2.5 but that one had slipped my memory and I've still been using X = (z and [y] or [w])[0] Thank! Jeff -Original Message- From: Kent Johnson [mailto:[EMAIL PROTECTED] Sent: Friday, August 10, 2007 10:23 AM To: S

Re: [Tutor] Losing the expressiveness ofC'sfor-statement?/RESENDwith example

2007-08-10 Thread Smith, Jeff
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Stephen McInerney wrote: >> The C for-loop syntax itself is not error-prone at all. >> Unless you mean off-by-one errors etc., missing initializations, and >> those are mostly semantic not syntax-related. > Yeah other th

Re: [Tutor] Losing the expressiveness of C'sfor-statement?/RESENDwith example

2007-08-07 Thread Smith, Jeff
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stephen McInerney From: [EMAIL PROTECTED]; tutor@python.org >>As to your particular case one non while option would be a generateor: >> >>def half(n): >> while int(n) > 0: >>n = n/2 >>yield n >> >>for x in half(300)

[Tutor] DB switch

2007-06-29 Thread Smith, Jeff
We are converting a database from Oracle to SQL 2005. We have a Python script that currently uses Digital Creation's 'DCOracle' python module. Any guidance on how to convert this for use with SQL 2005 is appreciated. Jeff ___ Tutor maillist - Tutor

[Tutor] SMS to Python

2007-05-22 Thread Smith, Jeff
I would like to be able to send an SMS message from my phone which is then picked up by a Python script and acted on. I'm fairly proficient in Python and networking, but don't know much about SMS messaging. Where's the best place to start? Thanks, Jeff _

[Tutor] File locking

2007-03-12 Thread Smith, Jeff
I'm always disappointed when I find something that Python doesn't handle in a platform independent way. It seems to me that file locking is in that boat. 1. I don't see a way to atomically open a file for writing if and only if it doesn't exist without resorting to os.open and specialized platfo

[Tutor] Yet another list comprehension question

2007-03-02 Thread Smith, Jeff
I find a common thing to do is l = list() for i in some-iterator: if somefum(i) != list: l.append(somefun(i)) In other words, applying somefun to the results of the iterator return duplicates but I want the constructed list to contain none. l = [somefun(i) for i some-iterator] will

Re: [Tutor] Another list comprehension question

2007-02-27 Thread Smith, Jeff
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Fouhy Sent: Monday, February 26, 2007 4:00 PM To: Smith, Jeff Cc: tutor@python.org Subject: Re: [Tutor] Another list comprehension question On 27/02/07, Smith, Jeff <[EMAIL PROTECTED]> wrote:

Re: [Tutor] Another list comprehension question

2007-02-27 Thread Smith, Jeff
-Original Message- From: Bob Gailer [mailto:[EMAIL PROTECTED] Sent: Monday, February 26, 2007 3:53 PM To: Smith, Jeff Cc: tutor@python.org Subject: Re: [Tutor] Another list comprehension question >> files = list() >Or just files = [] I tend to prefer the former since it h

[Tutor] Another list comprehension question

2007-02-26 Thread Smith, Jeff
I'm probably missing something simple here but is there anyway to accomplish the following with a list comprehension? def get_clists(): return [1, 2, 3] def get_clist(num): if num == 1: return ['a', 'b', 'c'] if num == 2: return ['x', 'y', 'z'] if num == 3:

[Tutor] List and comprehension questions

2007-02-25 Thread Smith, Jeff
I'm getting use to using list iteration and comprehension but still have some questions. 1. I know to replace for i in range(len(list1)): do things with list1[i] with for li in list1: do things with li but what if there are two lists that you need to access in sync. Is the

Re: [Tutor] Calling a function by string name

2006-07-21 Thread Smith, Jeff
nal Message-From: Michael P. Reilly [mailto:[EMAIL PROTECTED] Sent: Friday, July 21, 2006 1:36 PMTo: Smith, JeffCc: tutor@python.orgSubject: Re: [Tutor] Calling a function by string nameOn 7/21/06, Smith, Jeff <[EMAIL PROTECTED]> wrote: I have an object and

[Tutor] Calling a function by string name

2006-07-21 Thread Smith, Jeff
Title: Message I have an object and I want to call a method that I have constructed the name for in a string.   For example: str_method = 'myfun' obj.str_method   Of course, this fails.  I know I could probably do this with exec but is there a better way?   For context, the specific appli

[Tutor] Truly generic database API

2006-06-06 Thread Smith, Jeff
I'm looking for a truly generic database API in that the underlying DB could be text, XML, SQL engine, etc. For instance, initially, the underlying database will probably be text files but we may at some point want to move to a real database server or possibly an XML file without having to recode

Re: [Tutor] For loop question

2006-05-10 Thread Smith, Jeff
At least with Python there's only one obvious way to do something :-) I'll see your simplification and raise (or lower) you a line. Why not simply: for item in file('hosts.txt'): tn = telnetlib.Telnet(item.strip()) Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PRO

Re: [Tutor] Can anyone help me?

2005-10-28 Thread Smith, Jeff
AMTo: Smith, Jeff; Tutor@python.orgSubject: Re: [Tutor] Can anyone help me?At 07:28 AM 10/28/2005, Smith, Jeff wrote: Aren't the odds just based on how many tickets you buy?  The odds aren'taffected by different people buying more tickets.  If only one personbuys a ticke

Re: [Tutor] Can anyone help me?

2005-10-28 Thread Smith, Jeff
Aren't the odds just based on how many tickets you buy? The odds aren't affected by different people buying more tickets. If only one person buys a ticket in the entire lottery system, his odds of winning are the same as if two people play, and the same as if 20 million play. Jeff -Original

[Tutor] Problem building Python on HP-UX

2005-09-02 Thread Smith, Jeff
I'm trying to build Python 2.4.1 on HP-UX 11.00 with full tcl/tk IDLE support. So far, I haven't had any luck. I always wind up getting errors of the form: ld: DP relative code in file /ptg/devtools/hppa1.1/pre/lib/libtk8.4.a(tkWindow.o) - shared library must be position independent. Use +z or

Re: [Tutor] try except continue (fwd)

2005-08-24 Thread Smith, Jeff
The problem with the original solutions is that strings are immutable so if not line.strip(): continue doesn't actually remote the new line from the end so when you do print line you get two new lines: one from the original and one from the print command. You either need import sys fo

Re: [Tutor] CVS for Python

2005-08-03 Thread Smith, Jeff
If this is a Windows box then I highly recommend CVSNT (http://www.cvsnt.com/) with TortoiseCVS (http://www.tortoisecvs.org/). I've heard good things about Subversion but haven't tried it yet and don't know how its Windows installation is. There is also a TortoiseSVN (http://www.tortoisesvn.org/)

[Tutor] HTML/text formatting question

2005-08-03 Thread Smith, Jeff
I have a tool that outputs data in either html or text output. Currently I'm writing chucks like: if html: print '' print '' print '' print 'Differences %s: %s' % (htypestr, lbl1) if html: ... This seems clunky and my next step was going to be to define generic functions

Re: [Tutor] Deleting an entry from a dictionary

2005-08-03 Thread Smith, Jeff
org Subject: Re: [Tutor] Deleting an entry from a dictionary Smith, Jeff wrote: > Ummm...that doesn't do what I asked. > > pop is a linguistic idiom for > > (val, mylist) = (mylist[-1], mylist[0:-1]) No, actually, not quite. >From the docs: s.pop([i]) same as x = s[i]; d

Re: [Tutor] Deleting an entry from a dictionary

2005-08-03 Thread Smith, Jeff
lto:[EMAIL PROTECTED] Sent: Wednesday, August 03, 2005 9:15 AM Cc: tutor@python.org Subject: Re: [Tutor] Deleting an entry from a dictionary Smith, Jeff wrote: > Speaking of which, I note that there is a pop for lists but no shift. > Is there a Python idiom for this or is it just >

Re: [Tutor] Deleting an entry from a dictionary

2005-08-03 Thread Smith, Jeff
Title: Message Although that works, I kinda prefer     del meals['breakfast'] since that explicitly indicates what is going on.   Speaking of which, I note that there is a pop for lists but no shift.  Is there a Python idiom for this or is it just val = mylist.shift() =>    (val, mylist)

Re: [Tutor] Something that Perl can do that Python can't?

2005-07-22 Thread Smith, Jeff
some sort of iteration over stdout, please let me know. Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Smith, Jeff Sent: Friday, July 22, 2005 4:37 PM To: Tutor Subject: [Tutor] Something that Perl can do that Python can't? So here it is: ha

[Tutor] Something that Perl can do that Python can't?

2005-07-22 Thread Smith, Jeff
So here it is: handle unbuffered output from a child process. Here is the child process script (bufcallee.py): import time print 'START' time.sleep(10) print 'STOP' In Perl, I do: open(FILE, "python bufcallee.py |"); while ($line = ) {

[Tutor] Buffering problem using subprocess module

2005-07-19 Thread Smith, Jeff
I am using the subprocess module in 2.4. Here's the fragment: bufcaller.py: import sys, subprocess proc = subprocess.Popen('python bufcallee.py', bufsize=0, shell=True, stdout=subprocess.PIPE) for line in proc.stdout: sys.stdout.write(line) bufcallee.py:

Re: [Tutor] Case ? (fwd)

2005-07-06 Thread Smith, Jeff
If you like the switch statement (which I do) and believe Python should have one (which I do) then you might take a look at this which someone posted when I asked this same question a few months ago: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410692 Jeff -Original Message- F

Re: [Tutor] Windows user variable ?

2005-06-27 Thread Smith, Jeff
I would personally suggest using getpass.getuser() for maximum portability. Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Sunday, June 26, 2005 6:16 PM To: tutor@python.org Subject: Re: [Tutor] Windows user variable ? Qu

Re: [Tutor] Interesting problem

2005-06-23 Thread Smith, Jeff
, property): d[entry] = getattr(self, entry) return d Thanks! Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: Thursday, June 23, 2005 4:39 PM To: Python Tutor Subject: Re: [Tutor] Interesting problem Smith,

Re: [Tutor] Interesting problem

2005-06-23 Thread Smith, Jeff
Here would be the usage: myinst = MyClass() print myinst.getprops_as_dict() would print {'var1': 1, 'var2': 2, 'var3': 3} Needless to say I want the instance values which might be different for each instance. I know that I could code it brute force, but I want to be able to add properties with

Re: [Tutor] Interesting problem

2005-06-23 Thread Smith, Jeff
ilto:[EMAIL PROTECTED] On Behalf Of Smith, Jeff Sent: Thursday, June 23, 2005 2:01 PM To: tutor@python.org Subject: [Tutor] Interesting problem Consider a class with a lt of properties. I would like a member function which generates a dictionary where the keys are the property names and the value

[Tutor] Interesting problem

2005-06-23 Thread Smith, Jeff
Consider a class with a lt of properties. I would like a member function which generates a dictionary where the keys are the property names and the values are the property values? Is this clear? How might I go about this? Jeff ___ Tutor maillist - T

Re: [Tutor] Perl equivalent of $#var

2005-05-18 Thread Smith, Jeff
y and I would prefer if now == $#colors Keep in mind this is not an exact statement of the problem but I believe it captures the full context. Jeff -Original Message- From: Danny Yoo [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 17, 2005 6:00 PM To: Smith, Jeff Cc: tutor@python.org S

[Tutor] Perl equivalent of $#var

2005-05-17 Thread Smith, Jeff
Is there a more Pythonic way to get the Perl equivalent of $#var other than len(var) - 1 Thanks, Jeff ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] I know you will hate this but...

2005-05-17 Thread Smith, Jeff
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrei >It seems problematic to me to NOT enforce standard *settings* (e.g. 4 spaces >per indentation level, no tabs). Any IDE can be used as long as the proper >settings are configured. Inconsistent indentation styles are very an

[Tutor] I know you will hate this but...

2005-05-17 Thread Smith, Jeff
I'm working on a Python development project which spans multiple people. We are all working on Windows and using the PyWin IDE. Our code is revision controlled using Perforce. Already we had one instance where the logical structure of a file was destroyed because indentation levels were changed a

Re: [Tutor] dicts&lists vs objects

2005-05-12 Thread Smith, Jeff
Those are good observations and I think answers part of the question. I think the other part is that even in OO code, how do you know what to make an object and what to just store in an existing data type like a list or dictionary. Personally, I use the "if it walks like a duck" rule. In other

[Tutor] XML to Python

2005-05-05 Thread Smith, Jeff
I'm able to use the built in XML parser to effect "normal" XML parsing usage but frequently, I'm not doing anything to complicated and would simply like to translate the XML file into a more "Pythonic" structure. What's the best way to do this? Something from the standard libraries would be pr

RE: [Tutor] Re: design questions: pythonic appraoch to ostriches

2005-04-25 Thread Smith, Jeff
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Greg T >>Think about it in the abstract. The Bird class makes >>the statement: >>all >>birds fly. Then you want to turn around and define a >>Bird that >>doesn't. >>Even doing >> >>def fly: >> pass >> >>makes no sense since what

RE: [Tutor] design questions: pythonic approach to ostriches

2005-04-25 Thread Smith, Jeff
This is an excellent observation and points to the real problem with the original question. The problem is that the base class has more features than some of the classes that will be dervied from it which is usually just plain wrong. Think about it in the abstract. The Bird class makes the state

[Tutor] A simple Perl to Python regex xlation question

2005-04-20 Thread Smith, Jeff
What's the quickest (and most Pythonic) way to do the following Perlism: $str = s/d+/d/; (i.e. collapsing multiple occurrences of the letter 'd' to just one) Thanks, Jeff ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/lis

RE: [Tutor] Of fish and foul...(aka the Perl require command)

2005-04-19 Thread Smith, Jeff
Thanks, That does the trick. Rather than make a function, I'm likely to just do: if sys.version_info[:3] < (X,Y,Z): raise RuntimeError Jeff -Original Message- From: Max Noel [mailto:[EMAIL PROTECTED] Sent: Monday, April 18, 2005 3:34 PM To: Smith, Jeff Cc: tutor@py

[Tutor] Of fish and foul...(aka the Perl require command)

2005-04-18 Thread Smith, Jeff
Is there a Python equivalent to the Perl require 5.6.0 Which enforces a minimum interpreter version? Is there a good Python for Perl Programmers book? It thought O'Reilly had one but I couldn't find it. Was this particular question in the book you recommend? Thanks, Jeff _

RE: [Tutor] Craps, eternal loop (Joseph Q.)

2005-04-14 Thread Smith, Jeff
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joseph Quigley Sent: Wednesday, April 13, 2005 6:57 PM To: tutor@python.org Subject: [Tutor] Craps, eternal loop (Joseph Q.) >I get an eternal loop on this game that I don't want and can't figure out >how t

RE: [Tutor] If elif not working in comparison

2005-03-29 Thread Smith, Jeff
Brian van den Broek wrote: > Sean Perry said unto the world upon 2005-03-29 03:48: > >> Kent Johnson wrote: >> Not without using round. Have *NO* faith in floating points. This is especially true when you are creating the decimals via division and the like. >>> >>> Can you be

RE: [Tutor] a shorter way to write this

2005-03-25 Thread Smith, Jeff
For all the talk of Python only having one way to do something which is why it's so much better than Perl, I've counted about 10 ways to do this :-) Jeff -Original Message- From: Sean Perry [mailto:[EMAIL PROTECTED] Sent: Friday, March 25, 2005 2:20 PM To: Tutor Tutor Subject: Re: [Tutor

RE: [Tutor] gensuitemodule?

2005-02-28 Thread Smith, Jeff
http://www.python.org/doc/2.3.5/mac/module-gensuitemodule.html -Original Message- From: Mike Hall [mailto:[EMAIL PROTECTED] Sent: Friday, February 25, 2005 7:19 PM To: tutor@python.org Subject: [Tutor] gensuitemodule? I'm seeing it used in a Python/Applescript tutorial, though am unclea

RE: [Tutor] sys.argv[1: ] help

2005-02-28 Thread Smith, Jeff
Richard, I have no problems running your example. It would be helpful in the future ot let us know which version and variant of Python you are running. I am using the canonical (as oppose to ActiveState) Python 2.4. >From the command prompt, type assoc .py and you should see .py=Python.File

[Tutor] Precompiling to bytecode

2005-02-24 Thread Smith, Jeff
I notice that python only pre-compiles imported modules and not the main script. The only way I seem to be able to get this to happen is to run python -c "import mainscript" Am I missing something? Thanks, Jeff ___ Tutor maillist - Tutor@python.org

RE: [Tutor] Simple question on creating a filter

2005-02-11 Thread Smith, Jeff
t, I've had the same problem with Perl but because of my newbie status I assumed I was doin' something wrong :-) -Original Message- From: Bill Mill [mailto:[EMAIL PROTECTED] Sent: Friday, February 11, 2005 9:38 AM To: Smith, Jeff Cc: tutor@python.org Subject: Re: [Tutor] Simple q

[Tutor] Simple question on creating a filter

2005-02-11 Thread Smith, Jeff
I'm sorry to both with such a simple question but I've looked in the normal places and don't see the quick and dirty answer I know must exist. I want to write a simple line selection filter that could be used like: filter < file In Perl I would do: while (<>) { print if line meets selec

RE: [Tutor] Re: Perl Symbology

2005-02-10 Thread Smith, Jeff
Abel, No, you don't have to escape them all. Perl treats single and double quotes differently. Single-quoted strings don't do interpolation and double-quoted strings do. Jeff -Original Message- From: Abel Daniel [mailto:[EMAIL PROTECTED] Sent: Thursday, February 10, 2005 12:23 PM To

[Tutor] Perl Symbology (was: Are you allowed to shoot camels?)

2005-02-10 Thread Smith, Jeff
To all those who talked about hating the symbology in Perl and the suggestion that it should be removed from a later version. I just remembered what you get for that symbology that I really do like about Perl: variable interpolation in strings: C: sprintf(newstr,"%s %d %f",s,n,r); Becomes a litt

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

2005-02-08 Thread Smith, Jeff
EMAIL PROTECTED] Sent: Tuesday, February 08, 2005 1:24 PM To: Smith, Jeff; Bob Gailer; tutor@python.org Subject: Re: [Tutor] Are you allowed to shoot camels? [kinda OT] > That's no good. You still get something printed out. In this case: > > None Of course, silly me, p will retur

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

2005-02-08 Thread Smith, Jeff
Jeff, It looks like that finally is the simplest expression of the original switch statement: import sys def p(): pass ftable = { 'a' : lambda: sys.stdout.write('a\n'), 'b' : lambda: sys.stdout.write('b or c\n'), 'c' : lambda: sys.stdout.write('b or c\n'), 'd'

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

2005-02-08 Thread Smith, Jeff
Alan, That's no good. You still get something printed out. In this case: None Jeff -Original Message- From: Alan Gauld [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 6:15 PM To: Smith, Jeff; Bob Gailer; tutor@python.org Subject: Re: [Tutor] Are you allowed to

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

2005-02-07 Thread Smith, Jeff
a: p} print ftable.get(var, lambda: 'default case')() And what you get is: That's hardly a pass :-) Jeff -Original Message- From: Alan Gauld [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 3:06 PM To: Smith, Jeff; Bob Gailer; tutor@python.org Subject: Re: [Tutor]

RE: [Tutor] manipulating a file

2005-02-07 Thread Smith, Jeff
-Original Message- From: Alan Gauld [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 2:49 PM To: Reed L. O'Brien; tutor@python.org Subject: Re: [Tutor] manipulating a file >You should add a newline character otherwise you will just >get one enormously long line! > >

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

2005-02-07 Thread Smith, Jeff
Gailer [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 10:10 AM To: Smith, Jeff; tutor@python.org Subject: RE: [Tutor] Are you allowed to shoot camels? [kinda OT] At 07:43 AM 2/7/2005, Smith, Jeff wrote: >That's kinda what I thought but a couple of people suggested that I &

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

2005-02-07 Thread Smith, Jeff
That's kinda what I thought but a couple of people suggested that I used lambdas to make it clearer that I figured I was doing something wrong... Jeff -Original Message- From: Bob Gailer [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 9:48 AM To: Smith, Jeff; tutor@pytho

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

2005-02-07 Thread Smith, Jeff
ftable.get(var, lambda: print 'default case')() File "C:\scratch\Script1.py", line 2 ftable = { 'a' : lambda: print 'a', ^ SyntaxError: invalid syntax Jeff -----Original Message- From: Alan Gauld [mailto:[EMAIL PR

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

2005-02-04 Thread Smith, Jeff
l for us to be anything but generous and kind with each other. I guess this is a hot topic. :^) Marilyn On Fri, 4 Feb 2005, Smith, Jeff wrote: > Now who's joking? Are you saying that > > switch var: > case 'a': > print 'a' >

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

2005-02-04 Thread Smith, Jeff
x27;a' : do_this_function, 'b' : do_that_function, 'c' : do_that_function, 'd' : do_pass_function } ftable.get(var, do_default_function)() Ugh! -Original Message- From: Alan Gauld [mailto:[EMAIL PROTECTED] Sent: Friday, Februar

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

2005-02-04 Thread Smith, Jeff
Roel, That was well put. Too many people complain about certain language features because of the way they are abused independent of whether or not they have any value when used properly. In that case it's throwing the baby out with the bath-water...and won't achieve anything since bad programmer

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

2005-02-04 Thread Smith, Jeff
with Pascal and decided it was too terse :-) PROCEDURE myfun Became PROCEDURE myfun BODY IS (or something similar, it's been years...err, decades) Jeff -Original Message- From: Alan Gauld [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005 6:31 PM To: Smith, Jeff; [EMAIL PROT

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

2005-02-04 Thread Smith, Jeff
they should be removed from the language. I also like Perl's unless statement but really prefer VBs DO/WHILE/UNTIL/LOOP constuct. Nothing beats it for clarity of expression. Jeff -Original Message- From: Alan Gauld [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005

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

2005-02-03 Thread Smith, Jeff
Who knows, maybe it's a left-brain, right-brain thing. And it wouldn't be the first time I was told my brain was "wired differently" from the general public. Just ask my wife :-) Jeff -Original Message- From: Alan Gauld [mailto:[EMAIL PROTECTED] Sent: Thursday,

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

2005-02-03 Thread Smith, Jeff
--- From: Alan Gauld [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005 5:14 PM To: [EMAIL PROTECTED]; Smith, Jeff Cc: tutor@python.org; [EMAIL PROTECTED] Subject: Re: [Tutor] Are you allowed to shoot camels? [kinda OT] > > For the non-Perl people here, let me defend Perl by saying it is

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

2005-02-03 Thread Smith, Jeff
ations. Jeff -Original Message- From: Jacob S. [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005 4:40 PM To: Smith, Jeff; [EMAIL PROTECTED]; tutor@python.org Subject: Re: [Tutor] Are you allowed to shoot camels? [kinda OT] MessageI hate to be a spoiled sport and do exactly w

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

2005-02-03 Thread Smith, Jeff
Title: Message Nicholas,   Well put.  I come from a physics FORTRAN background and when I decided to learn C and start using it I heard the same arguments: it's too hard to read.   It's a silly argument to use against a language.  It's like an English-only speaker claiming he won't learn Gr

RE: [Tutor] Matching with beginning of the line in the character set

2005-02-01 Thread Smith, Jeff
Kent Johnson [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 01, 2005 1:15 PM Cc: Tutor@python.org Subject: Re: [Tutor] Matching with beginning of the line in the character set Smith, Jeff wrote: > I want to match a string which is preceeded by a space or occurs at > the beginning of the li

[Tutor] Matching with beginning of the line in the character set

2005-02-01 Thread Smith, Jeff
I want to match a string which is preceeded by a space or occurs at the beginning of the line. I also don't want to catch the preceeding character as a group. I have found both of the following to work re.compile('(?:^|\s)string') re.compile('(?:\A|\s)string') But would prefer to

RE: [Tutor] Control flow

2005-01-28 Thread Smith, Jeff
One way out of the top level is to call sys.exit(1) -Original Message- From: Orri Ganel [mailto:[EMAIL PROTECTED] Sent: Friday, January 28, 2005 4:26 PM To: Gilbert Tsang; Tutor@python.org Subject: Re: [Tutor] Control flow Gilbert Tsang wrote: > Hi there, I have this logic that