On your python vs php talk

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

On your python vs php talk

vitalif
Hi!

The question is a good base for a holy war :-)
I want to say that PHP has some advantages Python will never have - it's very simple in deployment, there is no fuss with library versions, nearly all needed features are already built-in including a good SAPI (!) so you don't need wsgi, psgi and etc, you don't need any virtualenvs for deploying because nobody typicaaly uses pear libraries :-)
PHP is faster (if you don't take pypy and etc in account).
Also I personally HATE block formatting using indentation. It's so silly idea no more language in the world has. Also for example I don't like python's strict typization ideas (for example it throws exception if you concatenate long and str using +). PHP is simple and has no such problems.
And for webdev I don't like frameworks, either. I.e I don't like them at all - because I always feel they are trying to restrict me. So Django is not an argument for me, and may be not an argument for you too. And definitely you can't say django is just better than php.
What php misses it's the builtin metaprogramming, but in 99% cases you should better write code instead of doing metaprogramming.
So for webdev my opinion is that php is MUCH better than python.
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Svip
On 28 July 2013 09:52, Виталий Филиппов <[hidden email]> wrote:

> Also for example I don't like python's strict typization ideas (for example it throws exception if you concatenate long and str using +). PHP is simple and has no such problems.

Except, you know, that is not entirely true.  PHP's weak dynamic types
causes numerous problems.  You cannot compare strings in order to sort
them, you need to convert individual characters to their ASCII/Unicode
value and compare it that way (and that in itself is not always
perfect, because their value may not be in the same order as humans
consider an appropriate sorting[0]).

If I do `"10" == 10' in PHP, PHP will yield true.  I can force it to
say false (because they are not the same type) by using '===' (except
- of course - PHP developers fails to understand what the === operator
is for[1]).  But if I do `"10" < 11' in PHP, it will yield true,
because < does what == does (converts the types), but there is no way
to tell PHP, I don't want that.

Particularly because int nor str doesn't exist in the language, you
cannot cast things in PHP to control your types.

Furthermore, PHP has an annoying habit of doing stuff without warning you.

I recommend you reading this article:
http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

This is one of the main reasons I stopped contributing to MediaWiki; I
simply got tired of writing in PHP.  I don't like a language where I
constantly have to circumvent it, because its developers are stupider
than I am.

[0] Of course, no other languages solves this issue as well, so that's
another thing.
[1] === compares values and type… except with objects, where === is
only true if both operands are actually the same object! For objects,
== compares both value (of every attribute) and type, which is what
=== does for every other type.  Wat.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

vitalif
In reply to this post by vitalif
It's not "bad" design. It's "bad" only theoretically and just different
from strongly-typed languages. I like its "inconsistent" function names
- for a lot of functions they're similar to C and in most cases they're
very easy to remember, as opposed to some other languages, including
python (!!).

Of course there are some nuances, but they're in any language. And I
personally think "10" is semantically equal to 10 in most cases, so
comparison is not a problem, either. You just need to be slightly more
accurate while writing things.

And my main idea is that only a statically typed should try to be
strict. And python very oddly tries to be strict in some places while
being dynamically typed. Look, it doesn't concatenate string and long -
even Java does that!

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Robert Cummings
In reply to this post by Svip
On 13-07-28 06:33 AM, Svip wrote:

> On 28 July 2013 09:52, Виталий Филиппов <[hidden email]> wrote:
>
>> Also for example I don't like python's strict typization ideas (for example it throws exception if you concatenate long and str using +). PHP is simple and has no such problems.
>
> Except, you know, that is not entirely true.  PHP's weak dynamic types
> causes numerous problems.  You cannot compare strings in order to sort
> them, you need to convert individual characters to their ASCII/Unicode
> value and compare it that way (and that in itself is not always
> perfect, because their value may not be in the same order as humans
> consider an appropriate sorting[0]).
>
> If I do `"10" == 10' in PHP, PHP will yield true.  I can force it to
> say false (because they are not the same type) by using '===' (except
> - of course - PHP developers fails to understand what the === operator
> is for[1]).

You should prefix that statement with "some" so that it reads "some PHP
developers fails[sic] to understand what the === operator is for".

 > But if I do `"10" < 11' in PHP, it will yield true,

Because you didn't properly state what you wanted if this is not what
you wanted.

> because < does what == does (converts the types), but there is no way
> to tell PHP, I don't want that.

Indeed there is:

if( is_int( "10" ) && is_int( 11 ) && "10" < 11 )

> Particularly because int nor str doesn't exist in the language, you

Yes they do.

> cannot cast things in PHP to control your types.

One certainly can:

$int = (int)$string;

> Furthermore, PHP has an annoying habit of doing stuff without warning you.
>
> I recommend you reading this article:
> http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

The writer names 5 stances:

     predictable, consistent, concise, reliable, debuggable

I can only see one failing... consistent and much of that is for
historical reasons and the mirroring of C based library functions. All
turing complete languages are predictable by definition. PHP is
certainly concise compared to many languages. Reliability is dependent
on the skill level of the developer. Debuggable is certainly possible,
although perhaps more difficult than some languages. Screen prints, log
prints, and xdebug generally make the process simple enough.

Cheers,
Rob.



> This is one of the main reasons I stopped contributing to MediaWiki; I
> simply got tired of writing in PHP.  I don't like a language where I
> constantly have to circumvent it, because its developers are stupider
> than I am.
>
> [0] Of course, no other languages solves this issue as well, so that's
> another thing.
> [1] === compares values and type… except with objects, where === is
> only true if both operands are actually the same object! For objects,
> == compares both value (of every attribute) and type, which is what
> === does for every other type.  Wat.
>
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>

--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Svip
On 28 July 2013 17:48, Robert Cummings <[hidden email]> wrote:

> On 13-07-28 06:33 AM, Svip wrote:
>
>> Particularly because int nor str doesn't exist in the language, you
>
> Yes they do.

No, they don't.  They only exist in the context you describe below:

>> cannot cast things in PHP to control your types.
>
> One certainly can:
>
> $int = (int)$string;

Can I do var_dump(int);?  Well, it turns out the only thing you can do
is casting, but even casting in PHP is rather pointless.

> I can only see one failing... consistent and much of that is for historical reasons and the
> mirroring of C based library functions. All turing complete languages are predictable by
> definition. PHP is certainly concise compared to many languages. Reliability is dependent
> on the skill level of the developer. Debuggable is certainly possible, although perhaps more
> difficult than some languages. Screen prints, log prints, and xdebug generally make the
> process simple enough.

I have been doing a lot of debugging PHP in my time, and I know how it
works.  That doesn't change the fact that it is rather annoying and a
tedious process compared to other languages.  I also like that other
languages *tell* you stuff, rather than having to know all these small
quirks in a language; this create language overhead, meaning a
programmer needs to contain a lot of information readily available
when programming.

And for what?  So I can save 10 minutes when setting up, but enduring
6 months of torture?  Yeah, I think I'll pass.

PHP wasn't chosen for MediaWiki because it was the language the
development team (at least the current) liked the best; but because
the first developer on MediaWiki chose it.  And that's that.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Robert Cummings
On 13-07-28 12:22 PM, Svip wrote:

> On 28 July 2013 17:48, Robert Cummings <[hidden email]> wrote:
>
>> On 13-07-28 06:33 AM, Svip wrote:
>>
>>> Particularly because int nor str doesn't exist in the language, you
>>
>> Yes they do.
>
> No, they don't.  They only exist in the context you describe below:
>
>>> cannot cast things in PHP to control your types.
>>
>> One certainly can:
>>
>> $int = (int)$string;
>
> Can I do var_dump(int);?  Well, it turns out the only thing you can do
> is casting, but even casting in PHP is rather pointless.
>
>> I can only see one failing... consistent and much of that is for historical reasons and the
>> mirroring of C based library functions. All turing complete languages are predictable by
>> definition. PHP is certainly concise compared to many languages. Reliability is dependent
>> on the skill level of the developer. Debuggable is certainly possible, although perhaps more
>> difficult than some languages. Screen prints, log prints, and xdebug generally make the
>> process simple enough.
>
> I have been doing a lot of debugging PHP in my time, and I know how it
> works.  That doesn't change the fact that it is rather annoying and a
> tedious process compared to other languages.  I also like that other
> languages *tell* you stuff, rather than having to know all these small
> quirks in a language; this create language overhead, meaning a
> programmer needs to contain a lot of information readily available
> when programming.
>
> And for what?  So I can save 10 minutes when setting up, but enduring
> 6 months of torture?  Yeah, I think I'll pass.
>
> PHP wasn't chosen for MediaWiki because it was the language the
> development team (at least the current) liked the best; but because
> the first developer on MediaWiki chose it.  And that's that.

I debunked your original comments and you come back with more false
claims and subjective argumentation. I don't foresee a rational dialogue
emerging in the future so it's probably best to leave you to your PHP
loathing. As for why MediaWiki uses PHP... I guess that's what you get
when you invent something-- you get to choose the design and tools.

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Svip
In reply to this post by vitalif
On 28 July 2013 16:53,  <[hidden email]> wrote:

> It's not "bad" design. It's "bad" only theoretically and just different from
> strongly-typed languages. I like its "inconsistent" function names - for a
> lot of functions they're similar to C and in most cases they're very easy to
> remember, as opposed to some other languages, including python (!!).

For a lot of C functions from vastly different libraries; there is
nothing in the PHP library functions that make them easy to remember,
I often had to look them up.

> And my main idea is that only a statically typed should try to be strict.
> And python very oddly tries to be strict in some places while being
> dynamically typed. Look, it doesn't concatenate string and long - even Java
> does that!

You are confusing two kinds of type languages; Java is strongly
strict, while Python is strongly dynamic.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Petr Bena
In reply to this post by vitalif
I don't know you man, unfortunatelly I can't evel spell your name...
but I really like you, because the way you feel about python is
exactly the same way I feel about it :-) I was thinking there is no
one else on this world who hate the way of python's syntatx just as I
do :-)

And as I already stated once, I didn't start this discussion to start
a war (not that I wouldn't like it) I just wanted to find out what's
so cool on python and why in the world would people prefer it over
php.

On Sun, Jul 28, 2013 at 9:52 AM, Виталий Филиппов <[hidden email]> wrote:

> Hi!
>
> The question is a good base for a holy war :-)
> I want to say that PHP has some advantages Python will never have - it's very simple in deployment, there is no fuss with library versions, nearly all needed features are already built-in including a good SAPI (!) so you don't need wsgi, psgi and etc, you don't need any virtualenvs for deploying because nobody typicaaly uses pear libraries :-)
> PHP is faster (if you don't take pypy and etc in account).
> Also I personally HATE block formatting using indentation. It's so silly idea no more language in the world has. Also for example I don't like python's strict typization ideas (for example it throws exception if you concatenate long and str using +). PHP is simple and has no such problems.
> And for webdev I don't like frameworks, either. I.e I don't like them at all - because I always feel they are trying to restrict me. So Django is not an argument for me, and may be not an argument for you too. And definitely you can't say django is just better than php.
> What php misses it's the builtin metaprogramming, but in 99% cases you should better write code instead of doing metaprogramming.
> So for webdev my opinion is that php is MUCH better than python.
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Svip
In reply to this post by Robert Cummings
On 28 July 2013 18:36, Robert Cummings <[hidden email]> wrote:

> I debunked your original comments and you come back with more false claims
> and subjective argumentation.

You debunked my comment that casting is impossible; I concede that I
was wrong.  But it is the only context where you are allowed to use
'int'.  'int' isn't a keyword in PHP, '(int)' is.  And why?  There is
intval() after all.  It's only to match C syntax.  It's the same with
new, protected, public, private, etc. keywords for classes, despite
these not really being useful in a interpreted language.  The idea is
to catch these issues on compile time, which PHP doesn't have.[0]

Your is_int() solution is correct, but it isn't exactly pretty.  It's
another example of 'working against the language'.

> As
> for why MediaWiki uses PHP... I guess that's what you get when you invent
> something-- you get to choose the design and tools.

I don't blame MediaWiki for using PHP.  It makes pretty rational sense
at the time it was created.  And even if it was created today, it
might have been PHP as well.  I have often praised MediaWiki for its
excellent PHP (also notice so does the article I linked to).

[0] I know there are some systems that can compile PHP, but the
primary objective of PHP is not to be compiled.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Svip
In reply to this post by Petr Bena
On 28 July 2013 18:43, Petr Bena <[hidden email]> wrote:

> And as I already stated once, I didn't start this discussion to start
> a war (not that I wouldn't like it) I just wanted to find out what's
> so cool on python and why in the world would people prefer it over
> php.

To give you an answer that isn't just PHP bashing (by the way, I am no
big fan of Python myself); I think it has a lot to do with more
corporations having skin in the game.  Large companies like Google
have invested in Python, but few have invested in PHP.  Well, at least
not prominent ones like Google.

This gives Python a sense of 'serious language' compared to PHP's
'hobby language' sentiment.  And some programmers looks down on PHP's
hobby language status.  You can argue whether that is fair or not.

But Python is a different beast all together; its initial purpose - as
I recall - was fulfil those programs that were too large for bash
scripts, but too simple for C-programs.  It was not created for the
web, it was later applied to it; and this you can tell in the language
as well as its standard library.  Python feels like a script language,
it has not very good threading and concurrency mechanism, which have
been added to the language later.

Google even tried to improve Python, but eventually abandoned that
plan and came up with Go instead.

There doesn't exist popular frameworks like Django (which I also
loath) for PHP, because PHP's standard library (well bindings) fulfils
much of task itself.

I don't mind Python's indentation syntax, but I don't like its
underscored standard functions (like __init__) and whatnot; they look
incredibly ugly.  I also don't like that you have to create a
__init__.py file in a directory to make it a package; that seems silly
to me (and ugly).

As for why Python is cool?  Because it tries some new things (look at
the syntax) and it is a language more designed to the nature of being
interpreted than compiled (which is a syntax PHP mimics).  I remember
personally being excited about Python when I first really met it back
in 2007.  But now that excitement has vanished.

My issue with Python isn't so much setting it up (which is a pain
itself, don't get me wrong), but it's the fact that it's standard
library are rather missing on functionality for the web (there are
plenty of frameworks, and whatnot, but not in its standard library),
so I have to ask myself; what's the purpose of writing in Python
rather than PHP?

I'd rather write in neither.  But hating PHP has traction, and you
don't want to be the uncool guy who writes in PHP, so to some people,
Python is the only option.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Svip
In reply to this post by Svip
On 28 July 2013 18:37, Svip <[hidden email]> wrote:

> Java is strongly
> strict, while Python is strongly dynamic.

Woops, I think Java might be weakly strict and not strongly strict
(that's like Standard ML or Erlang).

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Martijn Hoekstra
In reply to this post by Svip
and how about that emacs eh, it got nothing on vim!


On Sun, Jul 28, 2013 at 6:54 PM, Svip <[hidden email]> wrote:

> On 28 July 2013 18:43, Petr Bena <[hidden email]> wrote:
>
> > And as I already stated once, I didn't start this discussion to start
> > a war (not that I wouldn't like it) I just wanted to find out what's
> > so cool on python and why in the world would people prefer it over
> > php.
>
> To give you an answer that isn't just PHP bashing (by the way, I am no
> big fan of Python myself); I think it has a lot to do with more
> corporations having skin in the game.  Large companies like Google
> have invested in Python, but few have invested in PHP.  Well, at least
> not prominent ones like Google.
>
> This gives Python a sense of 'serious language' compared to PHP's
> 'hobby language' sentiment.  And some programmers looks down on PHP's
> hobby language status.  You can argue whether that is fair or not.
>
> But Python is a different beast all together; its initial purpose - as
> I recall - was fulfil those programs that were too large for bash
> scripts, but too simple for C-programs.  It was not created for the
> web, it was later applied to it; and this you can tell in the language
> as well as its standard library.  Python feels like a script language,
> it has not very good threading and concurrency mechanism, which have
> been added to the language later.
>
> Google even tried to improve Python, but eventually abandoned that
> plan and came up with Go instead.
>
> There doesn't exist popular frameworks like Django (which I also
> loath) for PHP, because PHP's standard library (well bindings) fulfils
> much of task itself.
>
> I don't mind Python's indentation syntax, but I don't like its
> underscored standard functions (like __init__) and whatnot; they look
> incredibly ugly.  I also don't like that you have to create a
> __init__.py file in a directory to make it a package; that seems silly
> to me (and ugly).
>
> As for why Python is cool?  Because it tries some new things (look at
> the syntax) and it is a language more designed to the nature of being
> interpreted than compiled (which is a syntax PHP mimics).  I remember
> personally being excited about Python when I first really met it back
> in 2007.  But now that excitement has vanished.
>
> My issue with Python isn't so much setting it up (which is a pain
> itself, don't get me wrong), but it's the fact that it's standard
> library are rather missing on functionality for the web (there are
> plenty of frameworks, and whatnot, but not in its standard library),
> so I have to ask myself; what's the purpose of writing in Python
> rather than PHP?
>
> I'd rather write in neither.  But hating PHP has traction, and you
> don't want to be the uncool guy who writes in PHP, so to some people,
> Python is the only option.
>
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Petr Bena
We all know that VIM is best editor out there :P

On Sun, Jul 28, 2013 at 6:59 PM, Martijn Hoekstra
<[hidden email]> wrote:

> and how about that emacs eh, it got nothing on vim!
>
>
> On Sun, Jul 28, 2013 at 6:54 PM, Svip <[hidden email]> wrote:
>
>> On 28 July 2013 18:43, Petr Bena <[hidden email]> wrote:
>>
>> > And as I already stated once, I didn't start this discussion to start
>> > a war (not that I wouldn't like it) I just wanted to find out what's
>> > so cool on python and why in the world would people prefer it over
>> > php.
>>
>> To give you an answer that isn't just PHP bashing (by the way, I am no
>> big fan of Python myself); I think it has a lot to do with more
>> corporations having skin in the game.  Large companies like Google
>> have invested in Python, but few have invested in PHP.  Well, at least
>> not prominent ones like Google.
>>
>> This gives Python a sense of 'serious language' compared to PHP's
>> 'hobby language' sentiment.  And some programmers looks down on PHP's
>> hobby language status.  You can argue whether that is fair or not.
>>
>> But Python is a different beast all together; its initial purpose - as
>> I recall - was fulfil those programs that were too large for bash
>> scripts, but too simple for C-programs.  It was not created for the
>> web, it was later applied to it; and this you can tell in the language
>> as well as its standard library.  Python feels like a script language,
>> it has not very good threading and concurrency mechanism, which have
>> been added to the language later.
>>
>> Google even tried to improve Python, but eventually abandoned that
>> plan and came up with Go instead.
>>
>> There doesn't exist popular frameworks like Django (which I also
>> loath) for PHP, because PHP's standard library (well bindings) fulfils
>> much of task itself.
>>
>> I don't mind Python's indentation syntax, but I don't like its
>> underscored standard functions (like __init__) and whatnot; they look
>> incredibly ugly.  I also don't like that you have to create a
>> __init__.py file in a directory to make it a package; that seems silly
>> to me (and ugly).
>>
>> As for why Python is cool?  Because it tries some new things (look at
>> the syntax) and it is a language more designed to the nature of being
>> interpreted than compiled (which is a syntax PHP mimics).  I remember
>> personally being excited about Python when I first really met it back
>> in 2007.  But now that excitement has vanished.
>>
>> My issue with Python isn't so much setting it up (which is a pain
>> itself, don't get me wrong), but it's the fact that it's standard
>> library are rather missing on functionality for the web (there are
>> plenty of frameworks, and whatnot, but not in its standard library),
>> so I have to ask myself; what's the purpose of writing in Python
>> rather than PHP?
>>
>> I'd rather write in neither.  But hating PHP has traction, and you
>> don't want to be the uncool guy who writes in PHP, so to some people,
>> Python is the only option.
>>
>> _______________________________________________
>> Wikitech-l mailing list
>> [hidden email]
>> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>>
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: On your python vs php talk

Chad
In reply to this post by Petr Bena
On Sun, Jul 28, 2013 at 9:43 AM, Petr Bena <[hidden email]> wrote:

> And as I already stated once, I didn't start this discussion to start
> a war (not that I wouldn't like it) I just wanted to find out what's
> so cool on python and why in the world would people prefer it over
> php.
>
>
Yeah well, language choice along with editor choice only ever
end in holy war, no matter how good the intentions.

On Sun, Jul 28, 2013 at 10:41 AM, Petr Bena <[hidden email]> wrote:

> We all know that VIM is best editor out there :P
>

And with that, this thread has run its course. Please go back to
watching silly cat videos or whatever else you like to do in your
spare time.

-Chad
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l