The fact that _ and __ are intended as throw away values is only clear
to people who have read a particular doc about coding styles. If you
haven't read the doc, you don't know what is going on. I name my
throw away variables junk, and if there are lots of them, for instance
when I am reading fro
On 30/04/15 20:22, Roel Schroeven wrote:
Alan Gauld schreef op 2015-04-30 00:51:
Summarizing a bit, I think you make two main points (please correct me
if I'm wrong):
Your quite correct.
I'm probably a bit paranoid but as I said I spent a
significant bit of my production-programming career
Dave Angel schreef op 2015-04-30 21:33:
Well, are you aware that _ has a meaning in the debugger? It holds the
last value of an expression that wasn't assigned to a variable. or
something like that.
Yes, I know the meaning of _ in Python's interactive mode. It's
something I sometimes use fo
On 04/30/2015 03:22 PM, Roel Schroeven wrote:
Alan Gauld schreef op 2015-04-30 00:51:
> ...
Trying to visually scan for _ or even __ is hard. Also different
fonts make _ and __ hard to distinguish.
> ...
But they will be. Almost for certain. It's human nature and the nature
of code maint
Alan Gauld schreef op 2015-04-30 00:51:
> ...
Trying to visually scan for _ or even __ is hard. Also different
fonts make _ and __ hard to distinguish.
> ...
But they will be. Almost for certain. It's human nature and the nature
of code maintenance. If it's there somebody will find a use fo
On 29/04/15 22:11, Roel Schroeven wrote:
Alan Gauld schreef op 2015-04-29 18:43:
On 29/04/15 17:03, Jugurtha Hadjar wrote:
http://docs.python-guide.org/en/latest/writing/style/#create-an-ignored-variable
I've seen this before and strongly disagree with it.
I disagree with your disagreement
On 04/29/2015 09:50 AM, Peter Otten wrote:
My random observations:
(1) find() and create() look very similar. Try hard to factor out common
code. You might even combine it into a single method ensure_balance(phone).
I'll think about it. I can't see for now how I would combine the two
(each
Alan Gauld schreef op 2015-04-29 18:43:
On 29/04/15 17:03, Jugurtha Hadjar wrote:
http://docs.python-guide.org/en/latest/writing/style/#create-an-ignored-variable
I've seen this before and strongly disagree with it.
I disagree with your disagreement. I'll try to explain.
They are ambiguous
On 29/04/15 17:03, Jugurtha Hadjar wrote:
(__, cursor) = self.init_db()
Don't use the __ 'variable' here, be explicit, it makes
maintenance much easier.
I actually searched specifically for something like this. In MATLAB,
there's the ~ that does this. I'm not trying to write Python
On 04/29/2015 09:06 AM, Alan Gauld wrote:
In principle its an acceptable strategy. A close alternative
would be to name the queries as explicit class variables.
So for example you would use:
cur.execute(self.find_phone_query,())
Its less typing and less error prone in that you get a
syntax
Jugurtha Hadjar wrote:
> I have a class with methods that access a database (SQLite3). I have
> included an excerpt showin reading and writing and would like to know if
> I'm doing it right. (i.e: Is it bad code and what to improve).
>
> Here are some improvements and my rationale (check my thi
On 29/04/15 04:06, Jugurtha Hadjar wrote:
- Initially, each method had its SQL statement(s) inside, but I grouped
all statements in a dictionary, with operations as keys, as a class
'constant' as per previous advice on this mailing list.
We can't see that in the code you posted.
In principle i
Hello, all..
I have a class with methods that access a database (SQLite3). I have
included an excerpt showin reading and writing and would like to know if
I'm doing it right. (i.e: Is it bad code and what to improve).
Here are some improvements and my rationale (check my thinking):
- Initial
13 matches
Mail list logo