24 votes
Accepted

Using `any` to indicate a wildcard value

Instead of using a sentinel value like any or None with special-cased logic, you could create a type the implements the desired "everything goes" behavior using the same interface as the ...
Brian61354270's user avatar
8 votes

Common practice where to place "is" word while naming predicate function: at the beginning or in the middle?

This inconsistency is a combination of things: Language designers are not required to adopt naming conventions from other languages when inventing a new programming language. Naming conventions have ...
Greg Burghardt's user avatar
7 votes

When to prefer print over logging?

Printing and logging serve different purposes. The purpose of logging tools is that they provide you with information after the fact about what a piece of software was doing. These tools are designed ...
Bart van Ingen Schenau's user avatar
6 votes

Using `any` to indicate a wildcard value

I made the types Anything and Something for this purpose. Anything compares True with any other value, while Something compares True on anything that is not None: >>> Anything == 42 True >&...
Martin Vilcans's user avatar
5 votes

Using `any` to indicate a wildcard value

Here's another solution similar to Brian61354270's answer that's a little more generic. You might want to use this if you have to support other rules that are more complicated. As an example, I ...
JimmyJames's user avatar
  • 25.9k
5 votes

Common practice where to place "is" word while naming predicate function: at the beginning or in the middle?

One main reason might be that the "noun" in your hypothetical examples is a variable or an expression on which the predicate is applied, so it would be redundant to specify it in the name of ...
Hans-Martin Mosner's user avatar
4 votes

When to prefer print over logging?

Each has it's own capabilities. Print lets you write: to a hard coded file path to stdout to stderr only what you say to write Logging lets you write to a user configured file path to a user ...
candied_orange's user avatar
1 vote

Common practice where to place "is" word while naming predicate function: at the beginning or in the middle?

"is" or in some cases "has" should be the first part of the method name. For example bool nothingThere = box.isEmpty() bool nobodyThere = !car.hasPassengers(); Without the is I ...
gnasher729's user avatar
  • 43.5k
1 vote

Declaring code style settings in a Java project

OP did not describe the proposed changes to default format (TAB == three SPACE, maybe?). More importantly, it did not describe the positive benefit which would outweigh the various frictional ...
J_H's user avatar
  • 4,754

Only top scored, non community-wiki answers of a minimum length are eligible