New answers tagged

2

dir_name = /mydir; file_name = /file1 This approach is definitely wrong, and has led to disaster. "/file1" does contain a directory name, and that directory is the root directory. So if you accidentally use it with an empty dir_name, it will refer to the root directory. This is a good way to accidentally destroy the system.


4

Standardization is better than custom tailoring, but what's even better is just outright solving the problem and precluding the need for standardization. C# (and .Net in general) has solved this by providing the Path.Combine method, which takes in any amount of strings and concatenates them to form a single path, while also handling the / and \ characters ...


9

Relative paths are not strings. They are relative paths. They should be represented as some sort of Path object, not a string. The path separator between relative paths is not part of either path, so it should not be present in either. The proper way to resolve those relative paths, is to use a path resolver. Python has a library in the standard library for ...


1

The argument for creating these equivalent methods is one of naming, and is therefore of a documentative nature. There are no hard and fast rules for documentation, as this is a very subjective concept, defined by nothing else than "it helps humans understand better". The very nature of the field of education proves how you're not able to enshrine ...


Top 50 recent answers are included