Re: Moving from PHP to Python. Is it Possible

2009-12-29 Thread Aaron Watters
Sancar wants to move from PHP to Python. The following a shameless plug for WHIFF: http://whiff.sourceforge.net -- I wrote it partially because I wanted PHP-like features using Python, but better ;). On Dec 11, 5:26 am, Sancar Saran wrote: > Greetings. > After 3 days of crawling google, div

Re: Moving from PHP to Python. Is it Possible

2009-12-29 Thread Robert Kern
On 2009-12-29 15:26 PM, Aahz wrote: In article<4b2602a0$0$30660$426a3...@news.free.fr>, Bruno Desthuilliers wrote: zeph a �crit : 4) It's better to collect all your eventual output into a string that you print Yuck ! Definitly one of the worst advises you could give. By all mean, *DONT* d

Re: Moving from PHP to Python. Is it Possible

2009-12-29 Thread Aahz
In article <4b2602a0$0$30660$426a3...@news.free.fr>, Bruno Desthuilliers wrote: >zeph a écrit : >> >> 4) It's better to collect all your eventual output into a string that >> you print > >Yuck ! Definitly one of the worst advises you could give. > > >By all mean, *DONT* do that. Use a templating

Re: Moving from PHP to Python. Is it Possible

2009-12-21 Thread Bruno Desthuilliers
AppRe Godeck a écrit : On Mon, 14 Dec 2009 12:25:16 +0100, Bruno Desthuilliers wrote: r0g a écrit : Bruno Desthuilliers wrote: Sancar Saran a écrit : (snip) My problem is with PHP syntax and performance. I'm just trying to replicate my recepies in python... Python is not PHP, and trying to

Re: Moving from PHP to Python. Is it Possible

2009-12-19 Thread mdipierro
About you point 3). You may want to look into: http://www.web2py.com/php It translates a PHP page into a web2py template. It is crude and primitive and fails in some cases. Moreover a literal translation is not what you really want since you want to follow a more MVC design. Moreover it will not

Re: Moving from PHP to Python. Is it Possible

2009-12-19 Thread AppRe Godeck
On Mon, 14 Dec 2009 12:25:16 +0100, Bruno Desthuilliers wrote: > r0g a écrit : >> Bruno Desthuilliers wrote: >>> Sancar Saran a écrit : >>> (snip) My problem is with PHP syntax and performance. I'm just trying to replicate my recepies in python... >>> Python is not PHP, and trying to wr

Re: Moving from PHP to Python. Is it Possible

2009-12-14 Thread Bruno Desthuilliers
r0g a écrit : Bruno Desthuilliers wrote: Sancar Saran a écrit : (snip) My problem is with PHP syntax and performance. I'm just trying to replicate my recepies in python... Python is not PHP, and trying to write PHP in Python won't buy you much except pain and frustration. I think people ar

Re: Moving from PHP to Python. Is it Possible

2009-12-14 Thread r0g
Bruno Desthuilliers wrote: > Sancar Saran a écrit : > (snip) >> My problem is with PHP syntax and performance. I'm just trying to >> replicate my recepies in python... > > Python is not PHP, and trying to write PHP in Python won't buy you much > except pain and frustration. I think people are b

Re: Moving from PHP to Python. Is it Possible

2009-12-14 Thread Bruno Desthuilliers
Sancar Saran a écrit : (snip) My problem is with PHP syntax and performance. I'm just trying to replicate my recepies in python... Python is not PHP, and trying to write PHP in Python won't buy you much except pain and frustration. -- http://mail.python.org/mailman/listinfo/python-list

Re: Moving from PHP to Python. Is it Possible

2009-12-14 Thread Diez B. Roggisch
Yes, I understood. And I'm using large Global dictionary (or Array) to replicate those objects. State of the thing will store in there. But it wasn't an object. Just Assocative array. Staying in global space, Because. In web programming we do not store anything except session. Every object w

Re: Moving from PHP to Python. Is it Possible

2009-12-14 Thread Bruno Desthuilliers
zeph a écrit : (snip) 4) It's better to collect all your eventual output into a string that you print Yuck ! Definitly one of the worst advises you could give. By all mean, *DONT* do that. Use a templating system instead. -- http://mail.python.org/mailman/listinfo/python-list

Re: Moving from PHP to Python. Is it Possible

2009-12-13 Thread Lie Ryan
On 12/14/2009 12:04 PM, Sancar Saran wrote: On Monday 14 December 2009 02:10:16 am Diez B. Roggisch wrote: In my usage GLOBALS are too much useful to discard it. The problem with global variables is their scope. If you have a piece of code, the important thing to know is what influences it's b

Re: Moving from PHP to Python. Is it Possible

2009-12-13 Thread Nobody
On Fri, 11 Dec 2009 12:26:30 +0200, Sancar Saran wrote: > 1-) Can I create Global (read/write access anywhere from my code) Multi > dimensional, associative array (or hash) and store any kind of variable type. Global, no; at least not in the sense of e.g. C. Python doesn't have a global namespa

Re: Moving from PHP to Python. Is it Possible

2009-12-13 Thread Sancar Saran
On Monday 14 December 2009 02:10:16 am Diez B. Roggisch wrote: > >> 1) PHP does some really nasty things in how it treats globals, and you > >> will have to break yourself of those sorts of habits -- Python offers > >> much cleaner alternatives, like grouping similar functionality into > >> modules

Re: Moving from PHP to Python. Is it Possible

2009-12-13 Thread Diez B. Roggisch
1) PHP does some really nasty things in how it treats globals, and you will have to break yourself of those sorts of habits -- Python offers much cleaner alternatives, like grouping similar functionality into modules which can be imported; the import functionality in python is pretty flexible. Pyt

Re: Moving from PHP to Python. Is it Possible

2009-12-12 Thread Tino Wildenhain
MRAB schrieb: > zeph wrote: > [snip] >> 4) It's better to collect all your eventual output into a string that >> you print - there are examples at [3]. You can import from other >> modules as needed (even conditionally), grow your string for output, >> then finally print it like (this example was a

Re: Moving from PHP to Python. Is it Possible

2009-12-11 Thread zeph
On Dec 11, 8:58 am, MRAB wrote: > output = [''] > output.append('My Page') > output.append('') > output.append('Powers of two\n') > for n in range(1, 11): >      output.append('%s' % (2 ** n)) > > output.append('') > print ''.join(output) Agreed (I might join on '\n' though), I was just trying to

Re: Moving from PHP to Python. Is it Possible

2009-12-11 Thread imageguy
> So My question is. > For example I had this kind of python file and we want to use this as plugin > template > >   >   <% >   for n in range(3): >       # This indent will persist >   %> >   This paragraph will be >   repeated 3 times. >   <% >   # This line will cause the block to end >   %> >

Re: Moving from PHP to Python. Is it Possible

2009-12-11 Thread Sancar Saran
On Friday 11 December 2009 05:11:12 pm zeph wrote: > Hi Sancar, Hi zeph, Thanks for reply. And here my needs about those 2 two programming technique. > 1) PHP does some really nasty things in how it treats globals, and you > will have to break yourself of those sorts of habits -- Python offers

Re: Moving from PHP to Python. Is it Possible

2009-12-11 Thread MRAB
zeph wrote: [snip] 4) It's better to collect all your eventual output into a string that you print - there are examples at [3]. You can import from other modules as needed (even conditionally), grow your string for output, then finally print it like (this example was adapted from one found on [3]

Re: Moving from PHP to Python. Is it Possible

2009-12-11 Thread zeph
Hi Sancar, 1) PHP does some really nasty things in how it treats globals, and you will have to break yourself of those sorts of habits -- Python offers much cleaner alternatives, like grouping similar functionality into modules which can be imported; the import functionality in python is pretty fl

Moving from PHP to Python. Is it Possible

2009-12-11 Thread Sancar Saran
Greetings. I'm 35 yrs old self learner and who do daily PHP coding for food more than a decade. After ten years of PHP coding I'm getting bored and give try for learning new things. After 3 days of crawling google, diving in python and cursing, now I can show something on my linux/apache/mo