Skip to main content

All Questions

Filter by
Sorted by
Tagged with
5 votes
1 answer
3k views

Patterns for sharing context variables between functions

I am looking for ways of passing around a set of contextual variables that are required by functions. As a Python programmer, right now I can see three ways of solving the problem: passing them ...
Andrei Kucharavy's user avatar
1 vote
4 answers
18k views

How should you cleanly restrict object property types and values in Python?

I have been learning python from no long time ago. But nearly at the beginning I stumbled on simple question: how to set a restriction (limitation) on object value or object's properties without ...
Marat's user avatar
  • 21
12 votes
10 answers
4k views

How to write useful Java programs without using mutable variables

I was reading an article about functional programming where the writer states (take 25 (squares-of (integers))) Notice that it has no variables. Indeed, it has nothing more than three functions and ...
minusSeven's user avatar
4 votes
8 answers
1k views

One-use variables - has any language ever had them?

A principle that I follow is that, when an identifier is established, it should be a signal to the reader that the value referred to is indeed an abstraction which will be used more than once. That is,...
dharmatech's user avatar