PUNGGOL TUITION · PRACTICAL MASTERY GUIDE
If your child can check whether a path exists but cannot tell whether a program is about to cross into another filesystem, the missing idea is not “more Python syntax”. It is a precise model of a mount point and the platform evidence behind it.
By the second paragraph, here is the core lesson: Path.is_mount() returns a Boolean about a concrete path in the current operating-system environment. On POSIX it uses the documented parent device and root inode rules; on Windows, supported since Python 3.12, drive roots, UNC share roots and mounted filesystem directories are mount points.
This guide treats Python pathlib.Path.is_mount as a reasoning skill. It begins with the governing model, moves through worked examples and diagnostic routes, and ends with transfer cases, practice with explained answers, parent decisions and FAQs. The examples are proposed home or lesson activities; they are not claims about a physical Punggol branch, school affiliation, timetable, class size, fee or guaranteed result.
For a Punggol family, the practical aim is simple: a learner should be able to use a short study block before schoolwork, after CCA, or during a weekend library session without needing a large project. Each chapter is designed so the smallest useful example can be completed, discussed and saved as a test fixture.
The official technical reference for this article is Python 3 pathlib documentation for Path.is_mount(). Where the feature is version-sensitive or still developing, the article states that boundary explicitly. Examples were independently checked against the runtime or specification named in the reference section.
Choose a reading route
If the immediate concern is “I can copy the syntax but I cannot explain the result”, use the first route. If a real project is already failing, use the diagnostic route. Parents can use the final route to decide whether more practice, a smaller prerequisite or a different example is needed. For the wider learning framework, see How Studying Works.
Start from the model: Chapters 1–4. Begin with What Path.is_mount() actually asks and continue in order to Device boundaries on POSIX.
Diagnose a confusing result: Chapters 5–8. Begin with Ordinary directories and continue in order to Windows drive roots.
Build reliable examples: Chapters 9–12. Begin with Windows UNC shares and continue in order to Mount points are not junctions.
Transfer to real work: Chapters 13–16. Begin with Mount points are not symlinks and continue in order to Traversal policies.
Decide and teach: Chapters 17–20. Begin with Testing without depending on a particular laptop and continue in order to Choosing is_mount for the right job.
Open the full 20-chapter index
- 1. What Path.is_mount() actually asks
- 2. Concrete Path, not PurePath
- 3. The POSIX root rule
- 4. Device boundaries on POSIX
- 5. Ordinary directories
- 6. Missing paths and false results
- 7. Symlinks need an explicit fixture
- 8. Windows drive roots
- 9. Windows UNC shares
- 10. Mounted directories on Windows
- 11. Version boundary: Windows support arrived in 3.12
- 12. Mount points are not junctions
- 13. Mount points are not symlinks
- 14. Bind mounts are a documented limitation
- 15. Containers and mount namespaces
- 16. Traversal policies
- 17. Testing without depending on a particular laptop
- 18. Handling errors and races
- 19. Path.is_mount() and os.path.ismount()
- 20. Choosing is_mount for the right job
CHAPTER 1 OF 20 · Back to contents
1. What Path.is_mount() actually asks
The short answer: Path.is_mount() asks whether a concrete filesystem path is a mount point. The governing rule is: The answer describes a mount boundary, not whether a directory merely exists or looks important.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The method delegates to operating-system mount-point logic and therefore depends on a concrete Path plus the host filesystem. It returns a Boolean rather than a descriptive mount record. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the what path.is_mount() actually asks example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
for p in [Path('/'), Path('/tmp')]:
print(p, p.is_mount())
Expected result and reasoning. On a normal POSIX system the root path prints True, while /tmp usually prints False unless that directory is separately mounted. The second result is environment-dependent, which is why the learner must inspect rather than assume. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Treating every top-level directory as a mount point confuses directory hierarchy with filesystem boundaries. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Which concrete path is being tested, and what filesystem evidence would make it a mount point?”
- Evidence to collect: the absolute path, operating system and Boolean result
- Variable to hold constant: the surrounding setup, so the comparison isolates what path.is_mount() actually asks.
- Variable to change: replace an ordinary directory with the system root
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For what path.is_mount() actually asks, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a local homework folder. Apply what path.is_mount() actually asks in a local homework folder. The central question is whether the same rule still governs after the context changes. Path.is_mount() asks whether a concrete filesystem path is a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “The answer describes a mount boundary, not whether a directory merely exists or looks important.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a container workspace. Apply what path.is_mount() actually asks in a container workspace. The central question is whether the same rule still governs after the context changes. Path.is_mount() asks whether a concrete filesystem path is a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “The answer describes a mount boundary, not whether a directory merely exists or looks important.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a school-managed laptop. Apply what path.is_mount() actually asks in a school-managed laptop. The central question is whether the same rule still governs after the context changes. Path.is_mount() asks whether a concrete filesystem path is a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “The answer describes a mount boundary, not whether a directory merely exists or looks important.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a data-science notebook. Apply what path.is_mount() actually asks in a data-science notebook. The central question is whether the same rule still governs after the context changes. Path.is_mount() asks whether a concrete filesystem path is a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “The answer describes a mount boundary, not whether a directory merely exists or looks important.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Test the root path and an ordinary temporary directory; predict each Boolean before running. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The root is a mount point. An ordinary temporary directory is normally not, unless the environment mounted something there. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to distinguish “directory”, “filesystem” and “mount point” in plain language before adding platform details. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain what path.is_mount() actually asks, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Contents · Full contents · Next: Concrete Path, not PurePath →
CHAPTER 2 OF 20 · Back to contents
2. Concrete Path, not PurePath
The short answer: The method belongs to concrete filesystem paths because answering requires access to the live operating system. The governing rule is: PurePath performs lexical path manipulation; Path can perform system calls.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
A lexical path object can join or compare path components without touching a disk. A mount-point decision cannot be made from spelling alone, so the concrete class supplies the method. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the concrete path, not purepath example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path, PurePath
print(hasattr(Path('/'), 'is_mount'))
print(hasattr(PurePath('/'), 'is_mount'))
Expected result and reasoning. The concrete Path instance exposes is_mount; PurePath does not provide a meaningful filesystem query. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Assuming the string ‘/’ proves a mount point ignores the machine on which that spelling is interpreted. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Am I manipulating path text or asking the current operating system about a real path?”
- Evidence to collect: object type and the exact method lookup
- Variable to hold constant: the surrounding setup, so the comparison isolates concrete path, not purepath.
- Variable to change: swap Path for PurePath while keeping the same characters
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For concrete path, not purepath, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a removable drive. Apply concrete path, not purepath in a removable drive. The central question is whether the same rule still governs after the context changes. The method belongs to concrete filesystem paths because answering requires access to the live operating system. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “PurePath performs lexical path manipulation; Path can perform system calls.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a Windows family computer. Apply concrete path, not purepath in a Windows family computer. The central question is whether the same rule still governs after the context changes. The method belongs to concrete filesystem paths because answering requires access to the live operating system. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “PurePath performs lexical path manipulation; Path can perform system calls.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a backup script. Apply concrete path, not purepath in a backup script. The central question is whether the same rule still governs after the context changes. The method belongs to concrete filesystem paths because answering requires access to the live operating system. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “PurePath performs lexical path manipulation; Path can perform system calls.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a deployment check. Apply concrete path, not purepath in a deployment check. The central question is whether the same rule still governs after the context changes. The method belongs to concrete filesystem paths because answering requires access to the live operating system. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “PurePath performs lexical path manipulation; Path can perform system calls.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Explain why PurePath(‘/’).is_mount() is not the right model even though ‘/’ visually denotes a root on POSIX. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The missing operation is intentional: PurePath has no live filesystem authority. Use Path only when an environmental query is required. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Listen for the distinction between lexical reasoning and an observation about the present machine. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain concrete path, not purepath, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: What Path.is_mount() actually asks · Full contents · Next: The POSIX root rule →
CHAPTER 3 OF 20 · Back to contents
3. The POSIX root rule
The short answer: A POSIX filesystem root is identified as a mount point even though it has no distinct parent directory above it. The governing rule is: A path is a mount point when it and its parent are the same inode on the same device, or when their device identifiers differ.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
For the root, resolving the parent returns the root itself. Comparing inode and device values therefore provides the special root test described by the Python documentation. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the the posix root rule example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
root = Path('/')
print(root.parent == root)
print(root.is_mount())
Expected result and reasoning. Both expressions are True on POSIX: the root is its own parent lexically and is reported as a mount point. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Looking only for a different device number would miss the root case. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Does the path have the same inode and device as its parent because it is the filesystem root?”
- Evidence to collect: path stat data and parent stat data
- Variable to hold constant: the surrounding setup, so the comparison isolates the posix root rule.
- Variable to change: compare / with a normal child directory
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For the posix root rule, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a container workspace. Apply the posix root rule in a container workspace. The central question is whether the same rule still governs after the context changes. A POSIX filesystem root is identified as a mount point even though it has no distinct parent directory above it. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A path is a mount point when it and its parent are the same inode on the same device, or when their device identifiers differ.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a school-managed laptop. Apply the posix root rule in a school-managed laptop. The central question is whether the same rule still governs after the context changes. A POSIX filesystem root is identified as a mount point even though it has no distinct parent directory above it. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A path is a mount point when it and its parent are the same inode on the same device, or when their device identifiers differ.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a data-science notebook. Apply the posix root rule in a data-science notebook. The central question is whether the same rule still governs after the context changes. A POSIX filesystem root is identified as a mount point even though it has no distinct parent directory above it. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A path is a mount point when it and its parent are the same inode on the same device, or when their device identifiers differ.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a local homework folder. Apply the posix root rule in a local homework folder. The central question is whether the same rule still governs after the context changes. A POSIX filesystem root is identified as a mount point even though it has no distinct parent directory above it. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A path is a mount point when it and its parent are the same inode on the same device, or when their device identifiers differ.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Write the two documented POSIX conditions and identify which one applies to ‘/’. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The root satisfies the same-inode-and-device condition with its parent; an ordinary child normally does not. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask for both documented POSIX tests. If only device changes are mentioned, the root model is incomplete. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain the posix root rule, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Concrete Path, not PurePath · Full contents · Next: Device boundaries on POSIX →
CHAPTER 4 OF 20 · Back to contents
4. Device boundaries on POSIX
The short answer: A mounted filesystem commonly has a different device identifier from its parent directory. The governing rule is: A different st_dev value between path and parent is evidence of a mount point.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The operating system stat result includes a device identifier. pathlib uses the same underlying idea as os.path.ismount for the POSIX boundary check. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the device boundaries on posix example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
p = Path('/proc')
print(p.stat().st_dev, p.parent.stat().st_dev)
print(p.is_mount())
Expected result and reasoning. On many Linux systems /proc has a device identifier different from / and reports True. The exact path is environment-dependent, so record the observed numbers. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Assuming /proc exists or is mounted on every POSIX machine turns a useful fixture into an unportable claim. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Do path and parent report different device identifiers on this machine?”
- Evidence to collect: both st_dev values and is_mount result
- Variable to hold constant: the surrounding setup, so the comparison isolates device boundaries on posix.
- Variable to change: test a known ordinary directory beside the candidate
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For device boundaries on posix, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a Windows family computer. Apply device boundaries on posix in a Windows family computer. The central question is whether the same rule still governs after the context changes. A mounted filesystem commonly has a different device identifier from its parent directory. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A different st_dev value between path and parent is evidence of a mount point.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a backup script. Apply device boundaries on posix in a backup script. The central question is whether the same rule still governs after the context changes. A mounted filesystem commonly has a different device identifier from its parent directory. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A different st_dev value between path and parent is evidence of a mount point.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a deployment check. Apply device boundaries on posix in a deployment check. The central question is whether the same rule still governs after the context changes. A mounted filesystem commonly has a different device identifier from its parent directory. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A different st_dev value between path and parent is evidence of a mount point.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a removable drive. Apply device boundaries on posix in a removable drive. The central question is whether the same rule still governs after the context changes. A mounted filesystem commonly has a different device identifier from its parent directory. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A different st_dev value between path and parent is evidence of a mount point.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Choose a candidate mount visible on the current machine and compare its st_dev with the parent’s. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. If the device identifiers differ, the candidate meets the POSIX device-boundary rule. If not, do not force the expected answer; choose or inspect another candidate. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Value a well-recorded environment-dependent result more than a memorised claim about /proc. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain device boundaries on posix, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: The POSIX root rule · Full contents · Next: Ordinary directories →
CHAPTER 5 OF 20 · Back to contents
5. Ordinary directories
The short answer: Most directories are not separate mount points. The governing rule is: Existence and directory type are insufficient; the mount-point conditions must hold.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
An ordinary directory and its parent usually lie on the same device and have different inode numbers. It therefore fails both POSIX mount tests. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the ordinary directories example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as d:
p=Path(d)
print(p.is_dir(), p.is_mount())
Expected result and reasoning. The directory exists and is a directory, but is_mount normally returns False. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Equating is_dir() with is_mount() erases the central distinction this API provides. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Which mount condition, if any, does this existing directory satisfy?”
- Evidence to collect: is_dir result, is_mount result and stat comparison
- Variable to hold constant: the surrounding setup, so the comparison isolates ordinary directories.
- Variable to change: compare the temporary directory with its filesystem root
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For ordinary directories, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a school-managed laptop. Apply ordinary directories in a school-managed laptop. The central question is whether the same rule still governs after the context changes. Most directories are not separate mount points. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Existence and directory type are insufficient; the mount-point conditions must hold.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a data-science notebook. Apply ordinary directories in a data-science notebook. The central question is whether the same rule still governs after the context changes. Most directories are not separate mount points. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Existence and directory type are insufficient; the mount-point conditions must hold.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a local homework folder. Apply ordinary directories in a local homework folder. The central question is whether the same rule still governs after the context changes. Most directories are not separate mount points. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Existence and directory type are insufficient; the mount-point conditions must hold.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a container workspace. Apply ordinary directories in a container workspace. The central question is whether the same rule still governs after the context changes. Most directories are not separate mount points. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Existence and directory type are insufficient; the mount-point conditions must hold.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Explain how a path can return True for is_dir() and False for is_mount(). Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. A mount point is usually a directory, but an ordinary directory is not necessarily a mount point; the predicates answer different questions. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Use this as the quickest diagnostic if the learner keeps treating filesystem predicates as synonyms. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain ordinary directories, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Device boundaries on POSIX · Full contents · Next: Missing paths and false results →
CHAPTER 6 OF 20 · Back to contents
6. Missing paths and false results
The short answer: A nonexistent path does not become a mount point through its spelling. The governing rule is: For a missing or inaccessible candidate, the documented method returns False rather than proving a boundary.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The operation needs filesystem metadata. With no existing entry to examine, it cannot establish either POSIX mount condition. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the missing paths and false results example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
p=Path('/definitely-not-an-edukate-mount')
print(p.exists(), p.is_mount())
Expected result and reasoning. Both values should be False on a normal system where the chosen path does not exist. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Reading False as “safe to create here” goes beyond what the predicate establishes. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Does False mean ordinary existing directory, missing path, or another unsupported condition?”
- Evidence to collect: exists, is_dir and is_mount results together
- Variable to hold constant: the surrounding setup, so the comparison isolates missing paths and false results.
- Variable to change: create the directory temporarily and retest
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For missing paths and false results, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a backup script. Apply missing paths and false results in a backup script. The central question is whether the same rule still governs after the context changes. A nonexistent path does not become a mount point through its spelling. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “For a missing or inaccessible candidate, the documented method returns False rather than proving a boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a deployment check. Apply missing paths and false results in a deployment check. The central question is whether the same rule still governs after the context changes. A nonexistent path does not become a mount point through its spelling. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “For a missing or inaccessible candidate, the documented method returns False rather than proving a boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a removable drive. Apply missing paths and false results in a removable drive. The central question is whether the same rule still governs after the context changes. A nonexistent path does not become a mount point through its spelling. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “For a missing or inaccessible candidate, the documented method returns False rather than proving a boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a Windows family computer. Apply missing paths and false results in a Windows family computer. The central question is whether the same rule still governs after the context changes. A nonexistent path does not become a mount point through its spelling. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “For a missing or inaccessible candidate, the documented method returns False rather than proving a boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Test a deliberately missing path, then create an ordinary directory at a disposable location and compare. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. Both can yield is_mount False, but exists distinguishes the cases. A Boolean predicate must be interpreted with the surrounding checks needed by the application. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask learners to avoid conclusions that are stronger than the observed predicate. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain missing paths and false results, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Ordinary directories · Full contents · Next: Symlinks need an explicit fixture →
CHAPTER 7 OF 20 · Back to contents
7. Symlinks need an explicit fixture
The short answer: A symlink can make a pathname appear to lead to a mount while the boundary question follows operating-system path semantics. The governing rule is: Do not infer symlink behaviour from the target name; test the exact path and, when needed, its resolved target.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
Path.stat follows symlinks by default, but mount detection can still involve path-parent relationships that differ for the link and resolved location. A controlled fixture prevents an overgeneralisation. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the symlinks need an explicit fixture example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as d:
link=Path(d)/'root-link'
link.symlink_to('/')
print(link.is_mount(), link.resolve().is_mount())
Expected result and reasoning. On the verified Linux fixture, the symlink path reports False while its resolved target ‘/’ reports True. Record platform and version because filesystem behaviour is environmental. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Saying “it points to root, so it is root” ignores the link’s own location and parent relationship. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Am I asking about the symlink pathname or the resolved target path?”
- Evidence to collect: link status, resolved path and both Booleans
- Variable to hold constant: the surrounding setup, so the comparison isolates symlinks need an explicit fixture.
- Variable to change: replace the symlink with the target Path(‘/’)
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For symlinks need an explicit fixture, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a data-science notebook. Apply symlinks need an explicit fixture in a data-science notebook. The central question is whether the same rule still governs after the context changes. A symlink can make a pathname appear to lead to a mount while the boundary question follows operating-system path semantics. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Do not infer symlink behaviour from the target name; test the exact path and, when needed, its resolved target.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a local homework folder. Apply symlinks need an explicit fixture in a local homework folder. The central question is whether the same rule still governs after the context changes. A symlink can make a pathname appear to lead to a mount while the boundary question follows operating-system path semantics. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Do not infer symlink behaviour from the target name; test the exact path and, when needed, its resolved target.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a container workspace. Apply symlinks need an explicit fixture in a container workspace. The central question is whether the same rule still governs after the context changes. A symlink can make a pathname appear to lead to a mount while the boundary question follows operating-system path semantics. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Do not infer symlink behaviour from the target name; test the exact path and, when needed, its resolved target.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a school-managed laptop. Apply symlinks need an explicit fixture in a school-managed laptop. The central question is whether the same rule still governs after the context changes. A symlink can make a pathname appear to lead to a mount while the boundary question follows operating-system path semantics. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Do not infer symlink behaviour from the target name; test the exact path and, when needed, its resolved target.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Predict both calls, run them, and explain why the two path objects need not answer the same question. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The resolved target is the root mount. The link resides in an ordinary parent and did not report as a mount in the tested fixture. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
If the learner gives a universal claim, require the environment label and a minimal reproducible test. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain symlinks need an explicit fixture, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Missing paths and false results · Full contents · Next: Windows drive roots →
CHAPTER 8 OF 20 · Back to contents
8. Windows drive roots
The short answer: On supported Python versions, a Windows drive root is considered a mount point. The governing rule is: Drive roots are explicit Windows mount roots.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
Windows does not expose the POSIX inode-and-device model in the same way, so Python applies Windows-specific cases documented for the method. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the windows drive roots example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
# Run on Windows
print(Path('C:/').is_mount())
Expected result and reasoning. On Windows with Python 3.12 or later, the drive root reports True when it exists as a drive root. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Applying the POSIX parent-stat explanation word for word on Windows confuses the platform models. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Is this path a Windows drive root under a Python version that supports Windows is_mount?”
- Evidence to collect: sys.platform, Python version and drive spelling
- Variable to hold constant: the surrounding setup, so the comparison isolates windows drive roots.
- Variable to change: compare C:/ with an ordinary directory on that drive
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For windows drive roots, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a deployment check. Apply windows drive roots in a deployment check. The central question is whether the same rule still governs after the context changes. On supported Python versions, a Windows drive root is considered a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Drive roots are explicit Windows mount roots.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a removable drive. Apply windows drive roots in a removable drive. The central question is whether the same rule still governs after the context changes. On supported Python versions, a Windows drive root is considered a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Drive roots are explicit Windows mount roots.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a Windows family computer. Apply windows drive roots in a Windows family computer. The central question is whether the same rule still governs after the context changes. On supported Python versions, a Windows drive root is considered a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Drive roots are explicit Windows mount roots.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a backup script. Apply windows drive roots in a backup script. The central question is whether the same rule still governs after the context changes. On supported Python versions, a Windows drive root is considered a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Drive roots are explicit Windows mount roots.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Describe the expected contrast between C:/ and C:/Users without pretending the latter is always present. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The drive root is a mount point; an ordinary directory below it is normally not. Use paths that exist on the tested machine. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Encourage platform-specific explanations rather than forcing one mechanism onto every operating system. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain windows drive roots, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Symlinks need an explicit fixture · Full contents · Next: Windows UNC shares →
CHAPTER 9 OF 20 · Back to contents
9. Windows UNC shares
The short answer: A UNC share root is another Windows case reported as a mount point. The governing rule is: The share root, not every directory inside the share, is the boundary.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
A UNC path identifies a network server and share. Python 3.12 added Windows support that recognises this root case. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the windows unc shares example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
# Run with an accessible Windows share
root=Path(r'\\server\share\')
print(root.is_mount())
Expected result and reasoning. An accessible UNC share root is reported as a mount point on supported Python. Availability and permissions remain environmental. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Treating any path beginning with two backslashes as a verified live share ignores accessibility and exact root structure. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Is the tested path the share root, and is the share accessible in this environment?”
- Evidence to collect: exact UNC components, Python version and access result
- Variable to hold constant: the surrounding setup, so the comparison isolates windows unc shares.
- Variable to change: append an existing subdirectory beneath the share root
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For windows unc shares, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a local homework folder. Apply windows unc shares in a local homework folder. The central question is whether the same rule still governs after the context changes. A UNC share root is another Windows case reported as a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “The share root, not every directory inside the share, is the boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a container workspace. Apply windows unc shares in a container workspace. The central question is whether the same rule still governs after the context changes. A UNC share root is another Windows case reported as a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “The share root, not every directory inside the share, is the boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a school-managed laptop. Apply windows unc shares in a school-managed laptop. The central question is whether the same rule still governs after the context changes. A UNC share root is another Windows case reported as a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “The share root, not every directory inside the share, is the boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a data-science notebook. Apply windows unc shares in a data-science notebook. The central question is whether the same rule still governs after the context changes. A UNC share root is another Windows case reported as a mount point. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “The share root, not every directory inside the share, is the boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Compare the share root with one ordinary child directory and explain the boundary. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The root names the share boundary; a normal child typically does not. Failed access must be reported separately from conceptual prediction. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Do not ask a child to use family or school credentials in a demo; use an authorised test share only. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain windows unc shares, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Windows drive roots · Full contents · Next: Mounted directories on Windows →
CHAPTER 10 OF 20 · Back to contents
10. Mounted directories on Windows
The short answer: Windows can mount a volume into a directory, and supported pathlib recognises that directory. The governing rule is: A mounted filesystem directory is a mount point even when it is not written as a drive root.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
Volume mount points let a volume appear at a directory within another volume. This is distinct from an ordinary folder and from a junction. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the mounted directories on windows example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
# Replace with an authorised configured volume mount
p=Path(r'C:\mounts\data')
print(p.is_mount())
Expected result and reasoning. The result is True only when that directory is actually configured as a mounted filesystem location. The sample spelling alone creates no mount. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Assuming any directory named “mounts” is special confuses convention with operating-system state. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Has Windows configured a volume mount at this exact directory?”
- Evidence to collect: system configuration and the exact Path result
- Variable to hold constant: the surrounding setup, so the comparison isolates mounted directories on windows.
- Variable to change: compare configured mount directory with an ordinary sibling
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For mounted directories on windows, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a removable drive. Apply mounted directories on windows in a removable drive. The central question is whether the same rule still governs after the context changes. Windows can mount a volume into a directory, and supported pathlib recognises that directory. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A mounted filesystem directory is a mount point even when it is not written as a drive root.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a Windows family computer. Apply mounted directories on windows in a Windows family computer. The central question is whether the same rule still governs after the context changes. Windows can mount a volume into a directory, and supported pathlib recognises that directory. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A mounted filesystem directory is a mount point even when it is not written as a drive root.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a backup script. Apply mounted directories on windows in a backup script. The central question is whether the same rule still governs after the context changes. Windows can mount a volume into a directory, and supported pathlib recognises that directory. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A mounted filesystem directory is a mount point even when it is not written as a drive root.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a deployment check. Apply mounted directories on windows in a deployment check. The central question is whether the same rule still governs after the context changes. Windows can mount a volume into a directory, and supported pathlib recognises that directory. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A mounted filesystem directory is a mount point even when it is not written as a drive root.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Explain why the same-looking directory tree can contain one mount point and one ordinary folder. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The distinction comes from volume configuration, not the folder name or visual depth. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Use hypothetical paths clearly and never claim that a family computer has a configured mount unless it was checked. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain mounted directories on windows, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Windows UNC shares · Full contents · Next: Version boundary: Windows support arrived in 3.12 →
CHAPTER 11 OF 20 · Back to contents
11. Version boundary: Windows support arrived in 3.12
The short answer: Python version is part of the behaviour contract. The governing rule is: Windows support for Path.is_mount was added in Python 3.12; the method itself was added in 3.7.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
A portable script must know both whether the method exists and whether its platform behaviour is supported as documented. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the version boundary: windows support arrived in 3.12 example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
import sys
from pathlib import Path
print(sys.version_info[:3], sys.platform)
print(hasattr(Path('.'), 'is_mount'))
Expected result and reasoning. The output records the environment needed to interpret subsequent results. On Windows, require Python 3.12 or later for the documented support. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Testing only for method presence can miss a platform support boundary. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Which version introduced the method, and which introduced Windows support?”
- Evidence to collect: full Python version and sys.platform
- Variable to hold constant: the surrounding setup, so the comparison isolates version boundary: windows support arrived in 3.12.
- Variable to change: compare documentation for 3.11 and 3.12
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For version boundary: windows support arrived in 3.12, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a container workspace. Apply version boundary: windows support arrived in 3.12 in a container workspace. The central question is whether the same rule still governs after the context changes. Python version is part of the behaviour contract. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Windows support for Path.is_mount was added in Python 3.12; the method itself was added in 3.7.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a school-managed laptop. Apply version boundary: windows support arrived in 3.12 in a school-managed laptop. The central question is whether the same rule still governs after the context changes. Python version is part of the behaviour contract. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Windows support for Path.is_mount was added in Python 3.12; the method itself was added in 3.7.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a data-science notebook. Apply version boundary: windows support arrived in 3.12 in a data-science notebook. The central question is whether the same rule still governs after the context changes. Python version is part of the behaviour contract. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Windows support for Path.is_mount was added in Python 3.12; the method itself was added in 3.7.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a local homework folder. Apply version boundary: windows support arrived in 3.12 in a local homework folder. The central question is whether the same rule still governs after the context changes. Python version is part of the behaviour contract. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Windows support for Path.is_mount was added in Python 3.12; the method itself was added in 3.7.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Write a guard or deployment note for a script intended for Windows and POSIX machines. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. State Python 3.7+ for method availability and Python 3.12+ for documented Windows support; test the real deployment environment. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Teach learners to attach versions to behaviour claims, especially when a change note is explicit. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain version boundary: windows support arrived in 3.12, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Mounted directories on Windows · Full contents · Next: Mount points are not junctions →
CHAPTER 12 OF 20 · Back to contents
12. Mount points are not junctions
The short answer: A Windows junction and a filesystem mount are related path concepts but not interchangeable predicates. The governing rule is: Use is_junction() to ask whether a path is a junction; use is_mount() for the mount-point question.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
Python exposes separate methods because the operating-system objects and intended questions differ. A junction can redirect path traversal without necessarily being the mounted-filesystem case tested here. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the mount points are not junctions example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
p=Path(r'C:\example')
print(p.is_mount())
print(p.is_junction())
Expected result and reasoning. The pair of Booleans must be interpreted separately on a real Windows fixture. Neither should be inferred from the other. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Using one predicate as a shortcut for the other produces false classifications. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Which filesystem feature does the application actually need to detect?”
- Evidence to collect: both predicate results and the configured object type
- Variable to hold constant: the surrounding setup, so the comparison isolates mount points are not junctions.
- Variable to change: test a documented junction and a documented volume mount
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For mount points are not junctions, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a Windows family computer. Apply mount points are not junctions in a Windows family computer. The central question is whether the same rule still governs after the context changes. A Windows junction and a filesystem mount are related path concepts but not interchangeable predicates. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_junction() to ask whether a path is a junction; use is_mount() for the mount-point question.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a backup script. Apply mount points are not junctions in a backup script. The central question is whether the same rule still governs after the context changes. A Windows junction and a filesystem mount are related path concepts but not interchangeable predicates. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_junction() to ask whether a path is a junction; use is_mount() for the mount-point question.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a deployment check. Apply mount points are not junctions in a deployment check. The central question is whether the same rule still governs after the context changes. A Windows junction and a filesystem mount are related path concepts but not interchangeable predicates. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_junction() to ask whether a path is a junction; use is_mount() for the mount-point question.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a removable drive. Apply mount points are not junctions in a removable drive. The central question is whether the same rule still governs after the context changes. A Windows junction and a filesystem mount are related path concepts but not interchangeable predicates. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_junction() to ask whether a path is a junction; use is_mount() for the mount-point question.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Design a table with rows for ordinary directory, junction, drive root and mounted directory; predict both predicates. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The cells differ by object type. The exercise is about choosing the predicate that matches the policy, not forcing all special paths into one category. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
If terminology is shaky, pause and rebuild the comparison table before writing traversal logic. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain mount points are not junctions, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Version boundary: Windows support arrived in 3.12 · Full contents · Next: Mount points are not symlinks →
CHAPTER 13 OF 20 · Back to contents
13. Mount points are not symlinks
The short answer: Symbolic-link status and mount-point status answer orthogonal questions. The governing rule is: Use is_symlink() for link identity and is_mount() for a filesystem boundary.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
A link is a directory entry that redirects resolution; a mount point attaches a filesystem. One path can require both questions, but one result does not imply the other. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the mount points are not symlinks example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
p=Path('/tmp')
print(p.is_symlink(), p.is_mount())
Expected result and reasoning. An ordinary /tmp commonly prints False, False; a purpose-built symlink fixture provides a clearer contrast. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Calling every redirection a mount point replaces precise operating-system concepts with visual intuition. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Is the policy concerned with links, filesystem boundaries, or both?”
- Evidence to collect: lstat/link status plus mount status
- Variable to hold constant: the surrounding setup, so the comparison isolates mount points are not symlinks.
- Variable to change: replace a normal path with a symlink fixture
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For mount points are not symlinks, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a school-managed laptop. Apply mount points are not symlinks in a school-managed laptop. The central question is whether the same rule still governs after the context changes. Symbolic-link status and mount-point status answer orthogonal questions. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_symlink() for link identity and is_mount() for a filesystem boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a data-science notebook. Apply mount points are not symlinks in a data-science notebook. The central question is whether the same rule still governs after the context changes. Symbolic-link status and mount-point status answer orthogonal questions. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_symlink() for link identity and is_mount() for a filesystem boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a local homework folder. Apply mount points are not symlinks in a local homework folder. The central question is whether the same rule still governs after the context changes. Symbolic-link status and mount-point status answer orthogonal questions. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_symlink() for link identity and is_mount() for a filesystem boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a container workspace. Apply mount points are not symlinks in a container workspace. The central question is whether the same rule still governs after the context changes. Symbolic-link status and mount-point status answer orthogonal questions. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_symlink() for link identity and is_mount() for a filesystem boundary.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Give one traversal policy that stops at mounts and another that refuses symlinks; explain why they need different tests. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The policies protect against different boundary conditions and therefore need separate predicates. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask for the application risk first; then select the predicate. This prevents API names from driving the policy backwards. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain mount points are not symlinks, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Mount points are not junctions · Full contents · Next: Bind mounts are a documented limitation →
CHAPTER 14 OF 20 · Back to contents
14. Bind mounts are a documented limitation
The short answer: On Linux, a bind mount can be a mount point without changing device identifier. The governing rule is: Path.is_mount cannot reliably detect bind mounts on Linux.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The documented POSIX test relies on device changes or the root inode condition. A bind mount can retain the same device, so the evidence needed by this predicate may be absent. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the bind mounts are a documented limitation example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
# Linux shell fixture, requires authorised mount privileges
# mount --bind source target
# python -c "from pathlib import Path; print(Path('target').is_mount())"
Expected result and reasoning. The official documentation warns that the function is not able to reliably detect bind mounts. Do not turn a False result into proof that no bind mount exists. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Treating a known limitation as an ordinary negative result creates unsafe traversal assumptions. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Could this environment use bind mounts, and does the application need authoritative detection?”
- Evidence to collect: mount namespace information and the predicate result
- Variable to hold constant: the surrounding setup, so the comparison isolates bind mounts are a documented limitation.
- Variable to change: compare a device-changing mount with a bind mount
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For bind mounts are a documented limitation, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a backup script. Apply bind mounts are a documented limitation in a backup script. The central question is whether the same rule still governs after the context changes. On Linux, a bind mount can be a mount point without changing device identifier. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Path.is_mount cannot reliably detect bind mounts on Linux.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a deployment check. Apply bind mounts are a documented limitation in a deployment check. The central question is whether the same rule still governs after the context changes. On Linux, a bind mount can be a mount point without changing device identifier. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Path.is_mount cannot reliably detect bind mounts on Linux.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a removable drive. Apply bind mounts are a documented limitation in a removable drive. The central question is whether the same rule still governs after the context changes. On Linux, a bind mount can be a mount point without changing device identifier. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Path.is_mount cannot reliably detect bind mounts on Linux.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a Windows family computer. Apply bind mounts are a documented limitation in a Windows family computer. The central question is whether the same rule still governs after the context changes. On Linux, a bind mount can be a mount point without changing device identifier. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Path.is_mount cannot reliably detect bind mounts on Linux.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Explain why the documented POSIX rule can miss a bind mount even when the mount is real. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. Because the path and parent may share the same device identifier and the target is not the filesystem root, neither test necessarily identifies it. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
For security or backup boundaries, recommend platform-specific authoritative data rather than stretching this convenience predicate. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain bind mounts are a documented limitation, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Mount points are not symlinks · Full contents · Next: Containers and mount namespaces →
CHAPTER 15 OF 20 · Back to contents
15. Containers and mount namespaces
The short answer: A process sees mounts through its own operating-system namespace. The governing rule is: is_mount reports the environment visible to the running process, not a universal host truth.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
Containers can have separate mount namespaces. The same spelling may refer to different mount arrangements inside and outside the container. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the containers and mount namespaces example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
for name in ['/', '/proc', '/workspace']:
p=Path(name)
print(name, p.exists(), p.is_mount())
Expected result and reasoning. The results describe the current process namespace. Compare environments only when each records its own output and version. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Assuming a host observation automatically applies inside a container ignores namespace isolation. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Which process namespace produced this result?”
- Evidence to collect: container identity, path existence and result
- Variable to hold constant: the surrounding setup, so the comparison isolates containers and mount namespaces.
- Variable to change: run the same read-only fixture inside and outside a test container
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For containers and mount namespaces, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a data-science notebook. Apply containers and mount namespaces in a data-science notebook. The central question is whether the same rule still governs after the context changes. A process sees mounts through its own operating-system namespace. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “is_mount reports the environment visible to the running process, not a universal host truth.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a local homework folder. Apply containers and mount namespaces in a local homework folder. The central question is whether the same rule still governs after the context changes. A process sees mounts through its own operating-system namespace. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “is_mount reports the environment visible to the running process, not a universal host truth.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a container workspace. Apply containers and mount namespaces in a container workspace. The central question is whether the same rule still governs after the context changes. A process sees mounts through its own operating-system namespace. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “is_mount reports the environment visible to the running process, not a universal host truth.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a school-managed laptop. Apply containers and mount namespaces in a school-managed laptop. The central question is whether the same rule still governs after the context changes. A process sees mounts through its own operating-system namespace. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “is_mount reports the environment visible to the running process, not a universal host truth.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Document two legitimate reasons the same path spelling could yield different results. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. Different namespace mount tables and different path existence are sufficient explanations; investigate before calling one machine wrong. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
This is a strong transfer case for teaching that APIs observe an environment, not an abstract global filesystem. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain containers and mount namespaces, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Bind mounts are a documented limitation · Full contents · Next: Traversal policies →
CHAPTER 16 OF 20 · Back to contents
16. Traversal policies
The short answer: The useful question is often what a program should do at a mount boundary. The governing rule is: A predicate becomes valuable when tied to an explicit traversal or backup policy.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
A walker may choose not to cross into another filesystem, may log a boundary, or may allow selected mounts. The policy must also account for the predicate’s platform limits. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the traversal policies example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
def should_descend(p: Path) -> bool:
return p.is_dir() and not p.is_mount()
Expected result and reasoning. This simple policy skips detected mount points, but it is not a complete security boundary and inherits documented detection limitations. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Presenting the three-line function as universally safe ignores symlinks, races, permissions and bind mounts. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “What risk is the traversal policy reducing, and what cases remain outside the predicate?”
- Evidence to collect: policy statement, platform and logged decisions
- Variable to hold constant: the surrounding setup, so the comparison isolates traversal policies.
- Variable to change: add a separate symlink rule and an allowlist
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For traversal policies, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a deployment check. Apply traversal policies in a deployment check. The central question is whether the same rule still governs after the context changes. The useful question is often what a program should do at a mount boundary. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A predicate becomes valuable when tied to an explicit traversal or backup policy.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a removable drive. Apply traversal policies in a removable drive. The central question is whether the same rule still governs after the context changes. The useful question is often what a program should do at a mount boundary. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A predicate becomes valuable when tied to an explicit traversal or backup policy.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a Windows family computer. Apply traversal policies in a Windows family computer. The central question is whether the same rule still governs after the context changes. The useful question is often what a program should do at a mount boundary. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A predicate becomes valuable when tied to an explicit traversal or backup policy.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a backup script. Apply traversal policies in a backup script. The central question is whether the same rule still governs after the context changes. The useful question is often what a program should do at a mount boundary. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A predicate becomes valuable when tied to an explicit traversal or backup policy.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Write a policy for a homework backup tool that logs rather than silently crosses detected mounts. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. Check existence and directory type, identify detected mounts, log the path, and require an explicit allow decision. State the bind-mount limitation on Linux. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Parents can ask the learner to explain the policy in everyday terms before reviewing code. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain traversal policies, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Containers and mount namespaces · Full contents · Next: Testing without depending on a particular laptop →
CHAPTER 17 OF 20 · Back to contents
17. Testing without depending on a particular laptop
The short answer: Portable tests separate guaranteed cases from environment-dependent cases. The governing rule is: Use the POSIX root as a stable platform-specific case, ordinary temporary directories as negatives, and mark configured mounts as integration tests.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
A test suite should not assume /proc, a Windows drive letter beyond the current anchor, or a network share exists everywhere. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the testing without depending on a particular laptop example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
import os, tempfile
from pathlib import Path
if os.name == 'posix':
assert Path('/').is_mount()
with tempfile.TemporaryDirectory() as d:
assert not Path(d).is_mount()
Expected result and reasoning. The POSIX assertion is platform-gated; the temporary-directory negative is valid for the normal fixture unless the environment deliberately mounts into it. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Hard-coding one developer machine’s mount table makes a flaky curriculum example. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Which outcome is guaranteed by the platform contract, and which requires configured infrastructure?”
- Evidence to collect: test skip conditions and environment report
- Variable to hold constant: the surrounding setup, so the comparison isolates testing without depending on a particular laptop.
- Variable to change: move a configured-mount check to a labelled integration suite
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For testing without depending on a particular laptop, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a local homework folder. Apply testing without depending on a particular laptop in a local homework folder. The central question is whether the same rule still governs after the context changes. Portable tests separate guaranteed cases from environment-dependent cases. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use the POSIX root as a stable platform-specific case, ordinary temporary directories as negatives, and mark configured mounts as integration tests.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a container workspace. Apply testing without depending on a particular laptop in a container workspace. The central question is whether the same rule still governs after the context changes. Portable tests separate guaranteed cases from environment-dependent cases. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use the POSIX root as a stable platform-specific case, ordinary temporary directories as negatives, and mark configured mounts as integration tests.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a school-managed laptop. Apply testing without depending on a particular laptop in a school-managed laptop. The central question is whether the same rule still governs after the context changes. Portable tests separate guaranteed cases from environment-dependent cases. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use the POSIX root as a stable platform-specific case, ordinary temporary directories as negatives, and mark configured mounts as integration tests.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a data-science notebook. Apply testing without depending on a particular laptop in a data-science notebook. The central question is whether the same rule still governs after the context changes. Portable tests separate guaranteed cases from environment-dependent cases. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use the POSIX root as a stable platform-specific case, ordinary temporary directories as negatives, and mark configured mounts as integration tests.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Classify four proposed tests as unit-like, platform-specific or integration. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. Root-on-POSIX is platform-specific, an ordinary temporary directory is a minimal negative, configured UNC and volume mounts are integration fixtures. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Reward explicit skips with reasons; skipping an inapplicable environment is better than pretending it was tested. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain testing without depending on a particular laptop, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Traversal policies · Full contents · Next: Handling errors and races →
CHAPTER 18 OF 20 · Back to contents
18. Handling errors and races
The short answer: Filesystem state can change between checks, and other operations can still fail. The governing rule is: A Boolean mount check is an observation, not a lock or a guarantee about the next system call.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
Paths can be removed, permissions can change, and mounts can be altered after a check. Robust code handles errors at the operation that matters. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the handling errors and races example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
p=Path('/some/path')
if p.exists() and not p.is_mount():
print('Observed as ordinary; later operations still need error handling')
Expected result and reasoning. The message carefully describes an observation rather than promising safety. Real work must catch or propagate errors from the subsequent operation. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Check-then-act code that assumes the world cannot change introduces a race. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “What can change after is_mount returns, and where will the real operation handle failure?”
- Evidence to collect: timestamps, exception details and operation attempted
- Variable to hold constant: the surrounding setup, so the comparison isolates handling errors and races.
- Variable to change: remove or alter a disposable path between observation and action
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For handling errors and races, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a removable drive. Apply handling errors and races in a removable drive. The central question is whether the same rule still governs after the context changes. Filesystem state can change between checks, and other operations can still fail. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A Boolean mount check is an observation, not a lock or a guarantee about the next system call.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a Windows family computer. Apply handling errors and races in a Windows family computer. The central question is whether the same rule still governs after the context changes. Filesystem state can change between checks, and other operations can still fail. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A Boolean mount check is an observation, not a lock or a guarantee about the next system call.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a backup script. Apply handling errors and races in a backup script. The central question is whether the same rule still governs after the context changes. Filesystem state can change between checks, and other operations can still fail. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A Boolean mount check is an observation, not a lock or a guarantee about the next system call.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a deployment check. Apply handling errors and races in a deployment check. The central question is whether the same rule still governs after the context changes. Filesystem state can change between checks, and other operations can still fail. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “A Boolean mount check is an observation, not a lock or a guarantee about the next system call.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rewrite “This path is safe” as a bounded statement supported by the predicate. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. Say “At this observation, the path was not reported as a mount point under this environment.” Then name the next operation and its error handling. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Teach calibrated language; it is a technical skill, not mere caution. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain handling errors and races, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Testing without depending on a particular laptop · Full contents · Next: Path.is_mount() and os.path.ismount() →
CHAPTER 19 OF 20 · Back to contents
19. Path.is_mount() and os.path.ismount()
The short answer: pathlib offers the object-oriented spelling while os.path exposes the closely related functional API. The governing rule is: Choose the interface that fits the surrounding code, but keep the same platform limitations in view.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
Path.is_mount is documented in terms of the mount-point operation also exposed by os.path. The different calling styles do not create different filesystem truths. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the path.is_mount() and os.path.ismount() example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
import os
p=Path('/')
print(p.is_mount(), os.path.ismount(p))
Expected result and reasoning. On the verified POSIX fixture both calls report True for the root. A controlled comparison should use the same exact path object or spelling. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Assuming a different module name guarantees a second independent detection mechanism overstates the comparison. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Are the two calls receiving the same path in the same process and namespace?”
- Evidence to collect: both Boolean results, Python version and platform
- Variable to hold constant: the surrounding setup, so the comparison isolates path.is_mount() and os.path.ismount().
- Variable to change: compare root with an ordinary temporary directory
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For path.is_mount() and os.path.ismount(), a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a container workspace. Apply path.is_mount() and os.path.ismount() in a container workspace. The central question is whether the same rule still governs after the context changes. pathlib offers the object-oriented spelling while os.path exposes the closely related functional API. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Choose the interface that fits the surrounding code, but keep the same platform limitations in view.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a school-managed laptop. Apply path.is_mount() and os.path.ismount() in a school-managed laptop. The central question is whether the same rule still governs after the context changes. pathlib offers the object-oriented spelling while os.path exposes the closely related functional API. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Choose the interface that fits the surrounding code, but keep the same platform limitations in view.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a data-science notebook. Apply path.is_mount() and os.path.ismount() in a data-science notebook. The central question is whether the same rule still governs after the context changes. pathlib offers the object-oriented spelling while os.path exposes the closely related functional API. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Choose the interface that fits the surrounding code, but keep the same platform limitations in view.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a local homework folder. Apply path.is_mount() and os.path.ismount() in a local homework folder. The central question is whether the same rule still governs after the context changes. pathlib offers the object-oriented spelling while os.path exposes the closely related functional API. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Choose the interface that fits the surrounding code, but keep the same platform limitations in view.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Run both APIs on the same positive and negative fixture and explain any difference before choosing one. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. They should agree for the verified cases because they answer the same mount-point question; pathlib is convenient in Path-oriented code. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to choose based on code clarity, not imagined extra authority. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain path.is_mount() and os.path.ismount(), solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Handling errors and races · Full contents · Next: Choosing is_mount for the right job →
CHAPTER 20 OF 20 · Back to contents
20. Choosing is_mount for the right job
The short answer: Mastery ends with selecting, combining or rejecting the predicate for a stated need. The governing rule is: Use is_mount when its platform-defined mount-point question matches the policy and its limitations are acceptable.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
A backup UI, diagnostic report or teaching tool may benefit from the convenient Boolean. A security boundary or authoritative Linux bind-mount inventory may require other operating-system data. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the choosing is_mount for the right job example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
from pathlib import Path
def describe(p: Path) -> dict:
return {'exists':p.exists(),'directory':p.is_dir(),'mount':p.is_mount()}
Expected result and reasoning. The combined record avoids making is_mount carry questions it does not answer. The caller can make a transparent policy decision. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Calling the method merely because its name sounds relevant is API-first reasoning. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “What decision will this Boolean change, and what false negative or race would matter?”
- Evidence to collect: the downstream decision and documented limits
- Variable to hold constant: the surrounding setup, so the comparison isolates choosing is_mount for the right job.
- Variable to change: replace the use case with one requiring authoritative bind-mount detection
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For choosing is_mount for the right job, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a Windows family computer. Apply choosing is_mount for the right job in a Windows family computer. The central question is whether the same rule still governs after the context changes. Mastery ends with selecting, combining or rejecting the predicate for a stated need. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_mount when its platform-defined mount-point question matches the policy and its limitations are acceptable.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a backup script. Apply choosing is_mount for the right job in a backup script. The central question is whether the same rule still governs after the context changes. Mastery ends with selecting, combining or rejecting the predicate for a stated need. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_mount when its platform-defined mount-point question matches the policy and its limitations are acceptable.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a deployment check. Apply choosing is_mount for the right job in a deployment check. The central question is whether the same rule still governs after the context changes. Mastery ends with selecting, combining or rejecting the predicate for a stated need. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_mount when its platform-defined mount-point question matches the policy and its limitations are acceptable.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a removable drive. Apply choosing is_mount for the right job in a removable drive. The central question is whether the same rule still governs after the context changes. Mastery ends with selecting, combining or rejecting the predicate for a stated need. Preserve a tiny record of input, prediction and observed result so that an apparent exception can be investigated rather than guessed at. Start by naming the observable evidence, then apply the chapter rule “Use is_mount when its platform-defined mount-point question matches the policy and its limitations are acceptable.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Decide whether is_mount is suitable for a learning file-browser, a cross-filesystem backup boundary and a security sandbox. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. It suits informative UI with clear caveats; it may contribute to backup policy with platform-specific safeguards; it is insufficient alone for an authoritative security boundary. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask for a use-case verdict with reasons, not a universal thumbs-up or thumbs-down. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain choosing is_mount for the right job, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Path.is_mount() and os.path.ismount() · Full contents · Parent guide →
Parent guide: what mastery looks like
A learner has not mastered Python pathlib.Path.is_mount merely because one polished example runs. Look for four behaviours: they can state the rule in plain language; predict before executing; isolate one changed condition; and explain why a transfer case is the same problem or a different one. Those behaviours make progress visible without requiring a parent to become a specialist.
Use a ten-minute check-in. Ask the learner to choose one chapter, reconstruct its example from memory, and narrate the causal chain. Then change one input. If the learner can update the prediction and justify the change, stop. More repetitions are not automatically better. Save the two-case pair and return to it after a few days.
If every answer is hesitant, reduce the scope. Return to the earliest chapter whose rule cannot be stated accurately. If explanations are fluent but real tasks still fail, move to a capstone because the missing skill is likely transfer or diagnosis. If frustration rises, separate typing errors from conceptual errors and solve only one category in that session.
Capstone practice with explained routes
Capstone 1: Rebuild the smallest trustworthy fixture
Scenario. Create a disposable Python fixture that demonstrates mount-point detection without unrelated project code.
Route. Record environment, input, prediction and output. Keep one nearby contrast. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. The fixture is successful when another learner can reproduce the observation and explain the rule that separates the two cases. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 2: Diagnose a believable wrong explanation
Scenario. A learner has the correct output but explains it using the wrong mechanism.
Route. Change the one condition that the wrong explanation says should matter, while holding the real governing condition constant. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. If the prediction based on the wrong mechanism fails and the rule-based prediction holds, the contrast exposes the misconception. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 3: Handle an environment boundary
Scenario. Two machines or runtimes produce different observations.
Route. Capture versions, platform or browser, exact input and relevant state before comparing. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. A difference is not automatically an error. Use the primary source to identify versioned or environmental conditions, then retest. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 4: Design a parent check-in
Scenario. A parent has ten minutes and no specialist background.
Route. Ask for one rule, one prediction, one run and one changed condition. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. The learner demonstrates mastery by explaining the causal chain and revising from evidence, not by performing a long polished demo. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 5: Transfer into a larger project
Scenario. The isolated fixture works but the school or home project does not.
Route. Preserve the fixture, then compare project inputs and state one dependency at a time. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. The first differing dependency that changes the outcome becomes the next diagnostic focus; the verified rule remains the baseline. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 6: Write a regression check
Scenario. The behaviour must remain understood after a future update.
Route. Save the smallest positive case, the near miss and the version metadata. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. A useful regression check fails for a meaningful reason, reports the changed observation and points back to the governing rule. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 7: Explain a limitation honestly
Scenario. The chosen API or feature does not cover an important edge case.
Route. Name the limitation, show what evidence the tool does provide and identify a more authoritative route. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. The final advice is bounded: it neither discards the useful tool nor stretches it into a guarantee it cannot make. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 8: Choose the right tool
Scenario. Several related methods or commands could appear to solve the same task.
Route. Define desired output, evaluation timing, platform boundary and acceptable failure modes. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. Select the tool whose contract matches those needs and state why at least one tempting alternative was rejected. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Frequently asked questions
Is Python pathlib.Path.is_mount mainly a syntax topic?
No. Syntax is only the visible handle. The durable skill is deciding what the operation means, predicting its boundary conditions, and collecting evidence that distinguishes one explanation from another.
How long should one practice session be?
A focused ten-to-twenty-minute session is enough for one rule, one worked example and one contrast. Stop when the learner can explain the causal chain; save the fixture for later retrieval rather than adding tired repetitions.
Should a learner memorise every edge case?
Memorise the central rule and know where to consult the primary reference. Edge cases should be organised by cause—platform, input type, evaluation order, document tree or repository state—rather than stored as an unconnected list.
What should a parent ask if they do not code?
Ask for a prediction, the rule behind it, the observation that would disprove it, and one changed case. Those questions reveal understanding without requiring the parent to know the final technical answer in advance.
When is copying an example acceptable?
Copying is useful for establishing a trusted baseline. It becomes learning only after the student predicts the result, reconstructs the example, changes one condition and explains the changed outcome.
How can we tell a typing error from a conceptual error?
Run a known-good minimal fixture first. If that fixture fails, inspect setup and transcription. If it passes but the learner predicts the wrong outcome for a controlled variation, the misconception is conceptual.
Should practice happen in a large school project?
Not initially. Large projects contain too many moving parts. Begin in a disposable directory, tiny script or isolated HTML file, then transfer the verified rule into the larger task.
What belongs in revision notes?
Keep the rule in one sentence, a smallest successful example, a near miss, the observed output, the environment version and one diagnostic question. This compact record is more reusable than a page of copied prose.
What if different computers give different results?
Treat the difference as evidence. Record operating system, runtime or browser version, filesystem or repository state, and exact input. Then consult the versioned primary source before deciding that either result is wrong.
When should the learner move to a new topic?
Move on when they can explain the rule, predict two contrasting cases, diagnose a deliberately broken example and transfer the idea to a fresh context without step-by-step prompting.
References and verification notes
Primary technical source: Python 3 pathlib documentation for Path.is_mount(). The documentation states the POSIX tests, Windows cases, version history and the Linux bind-mount limitation.
The worked examples were checked with CPython 3.12.14 on Linux for POSIX root, temporary directory, missing path and symlink contrasts; Windows cases are bounded to the official platform documentation. The checks confirm the specific examples in this guide; they do not promise identical behaviour on an older version, a different operating system, a different browser implementation, or a repository with different state. Keep the version and environment with the saved fixture.
Last reviewed: 17 October 2026. This article is educational guidance for families and learners. It does not advertise a physical Punggol outlet or make admissions, affiliation, score or outcome guarantees.

