From: "matz (Yukihiro Matsumoto)" Date: 2021-11-18T05:13:44+00:00 Subject: [ruby-core:106113] [Ruby master Feature#16252] Hash#partition should return hashes Issue #16252 has been updated by matz (Yukihiro Matsumoto). We worry about compatibility. It's too hard to estimate the damage. Maybe we need a new name? Matz. ---------------------------------------- Feature #16252: Hash#partition should return hashes https://bugs.ruby-lang.org/issues/16252#change-94708 * Author: Dan0042 (Daniel DeLorme) * Status: Open * Priority: Normal ---------------------------------------- Hash#partition is implemented by Enumerable so it just returns two arrays of arrays ```ruby {1=>2,3=>4}.partition{|k,|k==1} #=> [[[1, 2]], [[3, 4]]] ``` But I think it would make more sense to behave similarly to Hash#select and Hash#reject ```ruby {1=>2,3=>4}.partition{|k,|k==1} #=> [{1=>2}, {3=>4}] ``` -- https://bugs.ruby-lang.org/ Unsubscribe: