On 2019-12-21 5:52 p.m., Kyle Stanley wrote:
> Python is not an OOP language. If you want to breathe and preach OOP, you should quite frankly just use Java.

Python isn't *strictly* or *exclusively* an object-oriented programming language, but since it does have strong support for OOP features, saying that "Python is not an OOP language" simply isn't true. As a highly general purpose language, Python allows its users to choose between paradigms based on unique needs and preferences.

I understand where you're coming from here, but I don't think it's particularly productive to push those who have a strong preference for OOP over to Java. Instead, try to explain why you prefer a different paradigm in this particular situation. If you can't see eye-to-eye with the other person, that's perfectly fine, but at least you have the chance of engaging in a productive discussion and perhaps learning a new perspective.

Oh. Okay. Fair enough.

Sorry, Gregory.



On Sat, Dec 21, 2019 at 3:10 PM Soni L. <fakedme...@gmail.com <mailto:fakedme%2...@gmail.com>> wrote:



    On 2019-12-21 4:58 p.m., Gregory Salvan wrote:
    Years ago there was an interesting movement called anti-if
    campaign, now it's more promotional, but the concept of "anti if"
    may help you find ways to remove the cases where your suggest
    "and if" and "or if" can apply.
    This article is particularly well written:
    https://code.joejag.com/2016/anti-if-the-missing-patterns.html

    If you have cases where you think "and if" and "or if" can be
    helpful, you probably underuse oop.

    I would very much rather not be told that OOP is the be-all
    end-all of programming. Python is not an OOP language. If you want
    to breathe and preach OOP, you should quite frankly just use Java.


    Le sam. 21 déc. 2019 à 20:32, Soni L. <fakedme...@gmail.com
    <mailto:fakedme%2...@gmail.com>> a écrit :



        On 2019-12-21 4:15 p.m., Andrew Barnert wrote:
        > > On Dec 21, 2019, at 08:41, Soni L. <fakedme...@gmail.com
        <mailto:fakedme%2...@gmail.com>> wrote:
        > >
        > > I'd like to see the ability to do:
        > >
        > > if x:
        > >  1
        > > and if y:
        > >  2
        > > or if z:
        > >  3
        > >
        > > The truth table for these would be:
        > >
        > > x | y | z | result
        > > 0 | _ | 0 | (none)
        > > 0 | _ | 1 | 3
        > > 1 | 0 | _ | 1,3
        > > 1 | 1 | _ | 1,2,3
        > >
        > > and each statement is evaluated once, when encountered.
        (as such, y and z may not be evaluated at all, if their
        evaluation is not necessary to determine the outcome.)
        >
        > So this is equivalent to:
        >
        >     if x:
        >         if y:
        >             1, 2, 3
        >         else:
        >             1, 3
        >     elif z:
        >         3
        >
        > I can see how the former saves me having to repeat the 3
        three times. But the cost is being less obvious about when
        exactly I get a 3 so I’m forced to work it through step by
        step—including the confusion about the 1,0,0 case, which, as
        you mentioned, is only clear if you imagine putting an else
        at the end (although maybe you’d get used to that once you’d
        read through enough of these?). It’s even less obvious if you
        do throw in an elif, or just add an and if to the end (so now
        the condition to get there is not “x and y or z and w” but, I
        think, “((x and y) or z) and w”?
        >
        > Does that advantage outweigh the disadvantage? Certainly
        not for this example. But that’s probably because even the
        rewritten example is meaningless and useless. Maybe it would
        be different with a realistic use case, but I can’t imagine
        what that would be. Surely you must have some case where you
        really wanted this, that motivated you to propose it?
        >
        >
        >

        "1" and "2" and "3" are pieces of code, ofc.

        it's actually more like:

        if flag := x:
           1
           if y:
             2
        if flag or z: # note that "or" is short-circuiting.
           3

        but more efficiently implemented in bytecode without that
        "flag" local
        showing up.

        it's literally meant for easing the translation of switch
        statements
        from other languages and nothing else. (well, at least the
        "or if" part.
        the "and if" part isn't very useful. maybe to reduce deep
        indentation I
        guess?)
        _______________________________________________
        Python-ideas mailing list -- python-ideas@python.org
        <mailto:python-ideas@python.org>
        To unsubscribe send an email to python-ideas-le...@python.org
        <mailto:python-ideas-le...@python.org>
        https://mail.python.org/mailman3/lists/python-ideas.python.org/
        Message archived at
        
https://mail.python.org/archives/list/python-ideas@python.org/message/NNVZQ5HITRW2357ED5SEWL5UDL4X5LWR/
        Code of Conduct: http://python.org/psf/codeofconduct/


    _______________________________________________
    Python-ideas mailing list --python-ideas@python.org  
<mailto:python-ideas@python.org>
    To unsubscribe send an email topython-ideas-le...@python.org  
<mailto:python-ideas-le...@python.org>
    https://mail.python.org/mailman3/lists/python-ideas.python.org/
    Message archived 
athttps://mail.python.org/archives/list/python-ideas@python.org/message/WNJUFZRW2ZJGE6CEVDTIESDBP47VD4N6/
    Code of Conduct:http://python.org/psf/codeofconduct/

    _______________________________________________
    Python-ideas mailing list -- python-ideas@python.org
    <mailto:python-ideas@python.org>
    To unsubscribe send an email to python-ideas-le...@python.org
    <mailto:python-ideas-le...@python.org>
    https://mail.python.org/mailman3/lists/python-ideas.python.org/
    Message archived at
    
https://mail.python.org/archives/list/python-ideas@python.org/message/2B7Q2M52XF3TEH33ONLKFY2WZB4WG3XL/
    Code of Conduct: http://python.org/psf/codeofconduct/


_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/3JQTL4L5IJNKOLZEYO6O5MEOGSUEBKGL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to