Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 17 submissions in the queue.
posted by martyb on Friday July 13 2018, @12:58PM   Printer-friendly
from the pass-it-on dept.

On a python developers' mailing list for the core developers, Python Committers, Benevolent Dictator for Life Guido van Rossum has announced that he is stepping down effective immediately and with out appointing a successor.

Now that PEP 572 is done, I don't ever want to have to fight so hard for a
PEP and find that so many people despise my decisions.

I would like to remove myself entirely from the decision process. I'll
still be there for a while as an ordinary core dev, and I'll still be
available to mentor people -- possibly more available. But I'm basically
giving myself a permanent vacation from being BDFL, and you all will be on
your own.

After all that's eventually going to happen regardless -- there's still
that bus lurking around the corner, and I'm not getting younger... (I'll
spare you the list of medical issues.)

I am not going to appoint a successor.

[...] I'll still be here, but I'm trying to let you all figure something out for
yourselves. I'm tired, and need a very long break.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2) by c0lo on Saturday July 14 2018, @09:35AM (3 children)

    by c0lo (156) on Saturday July 14 2018, @09:35AM (#707014) Journal

    If you haven't had any template metaprogramming experience, it will take you some time to get what's happening here. If this is the case:
    - SFINAE [cppreference.com]
    - see <type_traits> [cppreference.com]

    namespace detail {

    // SFINAE check for a method named `PostProcess`
    template <typename, typename T>
    struct has_PostProcess { // error case
        static_assert(
            std::integral_constant::value,
            "Second template parameter needs to be a function type."
        );
    };

    // specialization. Looking for a method named PostProcess declared by type X with rettype and args
    template <typename X, typename Ret, typename... Args>
    struct has_PostProcess<X, Ret(Args...)> {
    private:
        // constexpr data member - named `check` - of type function, will be used T has a PostProcess method
        // with matching arguments. The return type is either std::true_type or std::false_type
        template <typename T>
        static constexpr auto check(T*) ->
            typename std::is_same().PostProcess(std::declval()...)),
                Ret
            >::type;
        // generic version of the check data member if the more specialized check
        // is not matched
        template <typename>
        static constexpr std::false_type check(...);
        // Realize that, by SFINAE, only one of the above definition of `check` will prevail.

        // this says "Would I be to call the 'check' function, what would be the return type"?
        using response=decltype(check<X>(static_cast<X*>(nullptr)));
    public:
        // the constexpre value will be true (X does have a PostProcess method matching the required signature)
        // or false otherwise.
        static constexpr bool value=response::value;
    };

    }// namespace detail

    Can you manage from here?

    --
    https://www.youtube.com/watch?v=aoFiw2jMy-0
    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2  
  • (Score: 2) by Knowledge Troll on Saturday July 14 2018, @03:55PM (2 children)

    by Knowledge Troll (5948) on Saturday July 14 2018, @03:55PM (#707154) Homepage Journal

    Wow thanks again! Yeah that's beautiful, I just need a pointer really. I talked a bit with a friend and he introduced me to the type traits but said he had never done specialization. Thanks again! I will now explode my head.

    • (Score: 0) by Anonymous Coward on Saturday July 14 2018, @05:35PM

      by Anonymous Coward on Saturday July 14 2018, @05:35PM (#707216)

      > I just need a pointer really.

      Here you go: std::unique_ptr

      :D

    • (Score: 2) by c0lo on Saturday July 14 2018, @11:05PM

      by c0lo (156) on Saturday July 14 2018, @11:05PM (#707365) Journal

      Ah, shit, there are a few place where I missed to &lt; the <.

      //...
              // constexpr data member - named `check` - of type function, will be used T has a PostProcess method
              // with matching arguments. The return type is either std::true_type or std::false_type
              template
              static constexpr auto check(T*) ->
                      typename std::is_same<
                          decltype(std::declval<T>().PostProcess(std::declval<Args>()...)),
                          Ret
                      >::type;

      --
      https://www.youtube.com/watch?v=aoFiw2jMy-0