Re: Learning Python now coming from Perl

2008-12-09 Thread J. Cliff Dyer
On Sun, 2008-12-07 at 11:05 +0900, Bertilo Wennergren wrote: > Aahz wrote: > > > In article <[EMAIL PROTECTED]>, > > > Bertilo Wennergren <[EMAIL PROTECTED]> wrote: > > >> I don't suppose there is any introductory material out there that is > >> based on Python 3000 and that is also geared at

Re: Learning Python now coming from Perl

2008-12-09 Thread Roy Smith
Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > On the other hand, leaving out the parens returns the function itself, > > which you can then call later. I've often used this to create data-driven > > logic. > > I didn't say it wasn't useful, just that if you came from Perl like I > did, it

Re: Learning Python now coming from Perl

2008-12-09 Thread Nick Craig-Wood
Roy Smith <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > > My favourite mistake when I made the transition was calling methods > > without parentheses. In perl it is common to call methods without > > parentheses - in python this

Re: Learning Python now coming from Perl

2008-12-08 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > My favourite mistake when I made the transition was calling methods > without parentheses. In perl it is common to call methods without > parentheses - in python this does absolutely nothing! pychecker does > warn abo

Re: Learning Python now coming from Perl

2008-12-08 Thread Nick Craig-Wood
Bertilo Wennergren <[EMAIL PROTECTED]> wrote: > I'm planning to start learning Python now, using Python 3000. > I have no previous Python skills, but I now Perl pretty well. > I'm also well experienced with JavaScript. > > Any pointers and tips how I should go about getting into > Python? Re

Re: Learning Python now coming from Perl

2008-12-06 Thread Aahz
In article <[EMAIL PROTECTED]>, Bertilo Wennergren <[EMAIL PROTECTED]> wrote: > >The main reason I waited until Python 3000 came out is the new way >Unicode is handled. The old way seemed really broken to me. Much of >what I do when I program consists of juggling Unicode text (real >Unicode text w

Re: Learning Python now coming from Perl

2008-12-06 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "Python Nutter" <[EMAIL PROTECTED]> wrote: > At least if you push REs inform the readers where to get the a RE GUI > builder written in Python so they can build and *test* the complex and > unwieldy REs to perform anything beyond the basic pattern searches. Oh, my

Re: Learning Python now coming from Perl

2008-12-06 Thread MRAB
Bertilo Wennergren wrote: Aahz wrote: In article <[EMAIL PROTECTED]>, Bertilo Wennergren <[EMAIL PROTECTED]> wrote: I don't suppose there is any introductory material out there that is based on Python 3000 and that is also geared at people with a Perl background? Too early for that I gue

Re: Learning Python now coming from Perl

2008-12-06 Thread Bertilo Wennergren
Aahz wrote: In article <[EMAIL PROTECTED]>, Bertilo Wennergren <[EMAIL PROTECTED]> wrote: I don't suppose there is any introductory material out there that is based on Python 3000 and that is also geared at people with a Perl background? Too early for that I guess.. Honestly, the diffe

Re: Learning Python now coming from Perl

2008-12-06 Thread Python Nutter
> In article <[EMAIL PROTECTED]>, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > Well, as an old-time unix hacker (who learned REs long before Perl > existed), my question to you would be, "Is there any problem which > *shouldn't* be solved with an RE?" :-) > > One of the reasons REs don't get u

Re: Learning Python now coming from Perl

2008-12-06 Thread Python Nutter
Perl Cookbook for Python Programmers: http://pleac.sourceforge.net/pleac_python/index.html P3K as starting point (slight cringe) as long as you know the caveats. I'm of the mind as Christopher with regard to how Python 3.0 has been released on Python.org: """I don't think that Python 3.0 is a ba

Re: Learning Python now coming from Perl

2008-12-06 Thread Steven D'Aprano
On Sat, 06 Dec 2008 14:15:28 -0500, Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> On Sat, 06 Dec 2008 08:50:20 -0500, Roy Smith wrote: >> >> > For your first >> > project, pick something that's small enough that you think you could >> > tac

Re: Learning Python now coming from Perl

2008-12-06 Thread Carl Banks
On Dec 6, 12:30 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Aahz) > wrote: > > > In article <[EMAIL PROTECTED]>, > > Bertilo Wennergren  <[EMAIL PROTECTED]> wrote: > > > >I don't suppose there is any introductory material out there that is > > >base

Re: Learning Python now coming from Perl

2008-12-06 Thread Rainy
On Dec 6, 5:00 am, Bertilo Wennergren <[EMAIL PROTECTED]> wrote: > I'm planning to start learning Python now, using Python 3000. > I have no previous Python skills, but I now Perl pretty well. > I'm also well experienced with JavaScript. > > Any pointers and tips how I should go about getting into

Re: Learning Python now coming from Perl

2008-12-06 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 06 Dec 2008 08:50:20 -0500, Roy Smith wrote: > > > For your first > > project, pick something that's small enough that you think you could > > tackle it in under 50 lines of Perl. > > Is there anything which *c

Re: Learning Python now coming from Perl

2008-12-06 Thread Martin P. Hellwig
News123 wrote: What's more painful is to learn which functianilty is in which library and which library exists. Yes and one mistake I still often find myself doing is, when confronted with a particular problem, that I write some helper code to deal with it. Of course later on I discover tha

Re: Learning Python now coming from Perl

2008-12-06 Thread Roy Smith
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Bertilo Wennergren <[EMAIL PROTECTED]> wrote: > > > >I don't suppose there is any introductory material out there that is > >based on Python 3000 and that is also geared at people with a Perl > >b

Re: Learning Python now coming from Perl

2008-12-06 Thread News123
I fully agree with Roy's answer. COding small tasks is a good starting point. For quite some time you'll be of course less efficient than with your previous language, but that's part of the learning curve, isn't it. I guess you'll learn the syntax rather quickly. What's more painful is to learn w

Re: Learning Python now coming from Perl

2008-12-06 Thread Aahz
In article <[EMAIL PROTECTED]>, Bertilo Wennergren <[EMAIL PROTECTED]> wrote: > >I don't suppose there is any introductory material out there that is >based on Python 3000 and that is also geared at people with a Perl >background? Too early for that I guess.. Honestly, the differences between 2.x

Re: Learning Python now coming from Perl

2008-12-06 Thread Steven D'Aprano
On Sat, 06 Dec 2008 08:50:20 -0500, Roy Smith wrote: > For your first > project, pick something that's small enough that you think you could > tackle it in under 50 lines of Perl. Is there anything which *can't* be written in under 50 lines of Perl? :-) > One of the very first things you'll pr

Re: Learning Python now coming from Perl

2008-12-06 Thread Colin J. Williams
Bertilo Wennergren wrote: Roy Smith wrote: Bertilo Wennergren <[EMAIL PROTECTED]> wrote: I'm planning to start learning Python now, using Python 3000. I have no previous Python skills, but I now Perl pretty well. I'm also well experienced with JavaScript. Any pointers and tips how I should

Re: Learning Python now coming from Perl

2008-12-06 Thread Bertilo Wennergren
Roy Smith wrote: Bertilo Wennergren <[EMAIL PROTECTED]> wrote: I'm planning to start learning Python now, using Python 3000. I have no previous Python skills, but I now Perl pretty well. I'm also well experienced with JavaScript. Any pointers and tips how I should go about getting into Pyth

Re: Learning Python now coming from Perl

2008-12-06 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Bertilo Wennergren <[EMAIL PROTECTED]> wrote: > I'm planning to start learning Python now, using Python 3000. > I have no previous Python skills, but I now Perl pretty well. > I'm also well experienced with JavaScript. > > Any pointers and tips how I should go abo

Learning Python now coming from Perl

2008-12-06 Thread Bertilo Wennergren
I'm planning to start learning Python now, using Python 3000. I have no previous Python skills, but I now Perl pretty well. I'm also well experienced with JavaScript. Any pointers and tips how I should go about getting into Python? -- Bertilo Wennergren -- http://mail.pytho

Re: Coming from Perl

2007-09-18 Thread Steve Holden
Amer Neely wrote: > Bryan Olson wrote: >> Amer Neely wrote: >>> I don't have shell access but I can run 'which python' from a Perl >>> script, and I will try the different shebang line you suggested. >> And after trying it, Amer Neely reported: >> >>> I tried `which python` and `whereis python` an

Re: Coming from Perl

2007-09-17 Thread Amer Neely
Bryan Olson wrote: > Amer Neely wrote: >> I don't have shell access but I can run 'which python' from a Perl >> script, and I will try the different shebang line you suggested. > > And after trying it, Amer Neely reported: > >> I tried `which python` and `whereis python` and got 0 back as a >>

Re: Coming from Perl

2007-09-16 Thread Bryan Olson
Amer Neely wrote: > I don't have shell access but I can run 'which python' from a Perl > script, and I will try the different shebang line you suggested. And after trying it, Amer Neely reported: > I tried `which python` and `whereis python` and got 0 back as a result. > So it seems Python is n

Re: Coming from Perl

2007-09-16 Thread Amer Neely
Paddy wrote: > On Sep 13, 1:30 am, Amer Neely <[EMAIL PROTECTED]> wrote: >> I'm a complete newbie with Python, but have several years experience >> with Perl in a web environment. >> >> A question I have, if someone here is familiar with Perl, does Python >> have something like Perl's 'here documen

Re: Coming from Perl

2007-09-15 Thread Amer Neely
Bryan Olson wrote: > Amer Neely wrote: >> This seems to indicate that maybe my host needs to configure Apache to >> run python scripts? But I didn't need to do anything with mine. > > Another possibility: If it works on Windows but not Unix, check > the end-of-line characters. Windows ends each l

Re: Coming from Perl

2007-09-15 Thread Amer Neely
Bryan Olson wrote: > Amer Neely wrote: >> This seems to indicate that maybe my host needs to configure Apache to >> run python scripts? But I didn't need to do anything with mine. > > Another possibility: If it works on Windows but not Unix, check > the end-of-line characters. Windows ends each l

Re: Coming from Perl - SOLVED

2007-09-15 Thread Amer Neely
I V wrote: > On Thu, 13 Sep 2007 23:49:32 -0400, Amer Neely wrote: >> In trying to track down why this script would not run on my host, it has >> to come to light that Python is installed, however the Apache module is >> not. So, short story is - I was flogging a dead horse. > > Which Apache modul

Re: Coming from Perl

2007-09-14 Thread Bryan Olson
Amer Neely wrote: > This seems to indicate that maybe my host needs to configure Apache to > run python scripts? But I didn't need to do anything with mine. Another possibility: If it works on Windows but not Unix, check the end-of-line characters. Windows ends each line with the two character se

Re: Coming from Perl - SOLVED

2007-09-14 Thread I V
On Thu, 13 Sep 2007 23:49:32 -0400, Amer Neely wrote: > In trying to track down why this script would not run on my host, it has > to come to light that Python is installed, however the Apache module is > not. So, short story is - I was flogging a dead horse. Which Apache module? You don't need an

Re: Coming from Perl - SOLVED

2007-09-13 Thread Amer Neely
Amer Neely wrote: > I'm a complete newbie with Python, but have several years experience > with Perl in a web environment. > > A question I have, if someone here is familiar with Perl, does Python > have something like Perl's 'here document'? I've just searched and read > some postings on gener

Re: Coming from Perl

2007-09-13 Thread Paddy
On Sep 13, 1:30 am, Amer Neely <[EMAIL PROTECTED]> wrote: > I'm a complete newbie with Python, but have several years experience > with Perl in a web environment. > > A question I have, if someone here is familiar with Perl, does Python > have something like Perl's 'here document'? I've just search

Re: Coming from Perl

2007-09-13 Thread Amer Neely
Tim Golden wrote: > Amer Neely wrote: >> Richie Hindle wrote: [Amer] #!/usr/bin/python [...] On my home PC [...] [Thu Sep 13 04:16:03 2007] [error] [client 0.0.0.0] (OS 2)The system cannot find the file specified. >>> That's because on your home PC Python is somewhere like

Re: Coming from Perl

2007-09-13 Thread Tim Golden
Amer Neely wrote: > Richie Hindle wrote: >>> [Amer] >>> #!/usr/bin/python >>> [...] On my home PC [...] >>> [Thu Sep 13 04:16:03 2007] [error] [client 0.0.0.0] (OS 2)The system >>> cannot find the file specified. >> That's because on your home PC Python is somewhere like >> C:\Python25\python.exe,

Re: Coming from Perl

2007-09-13 Thread Amer Neely
Amer Neely wrote: > Richie Hindle wrote: >>> [Amer] >>> #!/usr/bin/python >>> [...] On my home PC [...] >>> [Thu Sep 13 04:16:03 2007] [error] [client 0.0.0.0] (OS 2)The system >>> cannot find the file specified. >> >> That's because on your home PC Python is somewhere like >> C:\Python25\python.e

Re: Coming from Perl

2007-09-13 Thread Amer Neely
Richie Hindle wrote: >> [Amer] >> #!/usr/bin/python >> [...] On my home PC [...] >> [Thu Sep 13 04:16:03 2007] [error] [client 0.0.0.0] (OS 2)The system >> cannot find the file specified. > > That's because on your home PC Python is somewhere like > C:\Python25\python.exe, not /usr/bin/python. >

My first Python CGI (was: Coming from Perl)

2007-09-13 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Amer Neely <[EMAIL PROTECTED]> wrote: >Amer Neely wrote: >> TheFlyingDutchman wrote: >>> On Sep 12, 5:30 pm, Amer Neely <[EMAIL PROTECTED]> wrote: I'm a complete newbie with Python, but have several years experience with Perl in a web environment. >>>

Re: Coming from Perl

2007-09-13 Thread Richie Hindle
> [Amer] > #!/usr/bin/python > [...] On my home PC [...] > [Thu Sep 13 04:16:03 2007] [error] [client 0.0.0.0] (OS 2)The system > cannot find the file specified. That's because on your home PC Python is somewhere like C:\Python25\python.exe, not /usr/bin/python. Are you sure /usr/bin/python is

Re: Coming from Perl

2007-09-13 Thread Amer Neely
Richie Hindle wrote: > [Amer] >> Can you or anyone see anything in the posted code that might be the >> cause? > >> #!/usr/bin/python >> import cgitb; cgitb.enable(display=0, logdir=".") >> import sys >> sys.stderr = sys.stdout >> print "Content-Type: text/html" >> print > > My guess would be th

Re: Coming from Perl

2007-09-13 Thread Richie Hindle
[Amer] > Can you or anyone see anything in the posted code that might be the > cause? > #!/usr/bin/python > import cgitb; cgitb.enable(display=0, logdir=".") > import sys > sys.stderr = sys.stdout > print "Content-Type: text/html" > print My guess would be that you don't have cgitb in your serv

Re: Coming from Perl

2007-09-13 Thread Amer Neely
Ben Finney wrote: > Amer Neely <[EMAIL PROTECTED]> writes: > >> Well, I have checked everything I can but I'm getting '500 Internal >> Server Error'. > > This is the HTTP response code saying that the program that should > have served the response document instead exited with an error. > > To de

Re: Coming from Perl

2007-09-13 Thread Ben Finney
Amer Neely <[EMAIL PROTECTED]> writes: > Well, I have checked everything I can but I'm getting '500 Internal > Server Error'. This is the HTTP response code saying that the program that should have served the response document instead exited with an error. To debug, you should first run the prog

Re: Coming from Perl

2007-09-13 Thread Amer Neely
Amer Neely wrote: > TheFlyingDutchman wrote: >> On Sep 12, 5:30 pm, Amer Neely <[EMAIL PROTECTED]> wrote: >>> I'm a complete newbie with Python, but have several years experience >>> with Perl in a web environment. >>> >>> A question I have, if someone here is familiar with Perl, does Python >>> ha

Re: Coming from Perl

2007-09-13 Thread Amer Neely
TheFlyingDutchman wrote: > On Sep 12, 5:30 pm, Amer Neely <[EMAIL PROTECTED]> wrote: >> I'm a complete newbie with Python, but have several years experience >> with Perl in a web environment. >> >> A question I have, if someone here is familiar with Perl, does Python >> have something like Perl's '

Re: Coming from Perl

2007-09-12 Thread Ben Finney
Amer Neely <[EMAIL PROTECTED]> writes: > print < > > Hello > > > EndHTML The equivalent in Python would be:: print """ Hello """ You can even use Python's standard textwrap module to indent your code properly:: import textwrap def foo(bar):

RE: Coming from Perl

2007-09-12 Thread Ryan Ginstrom
> On Behalf Of Amer Neely > I saw that and I guess that is the closest thing. In Perl I can do .. > > print < > > Hello > > > EndHTML >>> data = dict(title="Python Rocks!", content="I heart Python") >>> template = """ %(title)s %(content)s """ >>> print template % data Pytho

Re: Coming from Perl

2007-09-12 Thread Amer Neely
TheFlyingDutchman wrote: > On Sep 12, 5:30 pm, Amer Neely <[EMAIL PROTECTED]> wrote: >> I'm a complete newbie with Python, but have several years experience >> with Perl in a web environment. >> >> A question I have, if someone here is familiar with Perl, does Python >> have something like Perl's '

Re: Coming from Perl

2007-09-12 Thread TheFlyingDutchman
On Sep 12, 5:30 pm, Amer Neely <[EMAIL PROTECTED]> wrote: > I'm a complete newbie with Python, but have several years experience > with Perl in a web environment. > > A question I have, if someone here is familiar with Perl, does Python > have something like Perl's 'here document'? I've just search

Re: Coming from Perl

2007-09-12 Thread Amer Neely
Ben Finney wrote: > Amer Neely <[EMAIL PROTECTED]> writes: > >> A question I have, if someone here is familiar with Perl, does Python >> have something like Perl's 'here document'? > > I'm not sure exactly what behaviour you want, but Python accepts > literal strings to be triple-quoted (i.e. del

Re: Coming from Perl

2007-09-12 Thread Ben Finney
Amer Neely <[EMAIL PROTECTED]> writes: > A question I have, if someone here is familiar with Perl, does Python > have something like Perl's 'here document'? I'm not sure exactly what behaviour you want, but Python accepts literal strings to be triple-quoted (i.e. delimited by """ pairs or ''' pai

Coming from Perl

2007-09-12 Thread Amer Neely
I'm a complete newbie with Python, but have several years experience with Perl in a web environment. A question I have, if someone here is familiar with Perl, does Python have something like Perl's 'here document'? I've just searched and read some postings on generating HTML but they all seem t