[Tutor] Good Taste Question: Using SQLite3 in Python

Dave Angel davea at davea.name
Thu Apr 30 21:33:49 CEST 2015


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 maintenance. If it's there somebody will find a use for it.
>> The fact that 5 or 10 years earlier the author didn't intend for it to
>> be used is immaterial.
>
> Summarizing a bit, I think you make two main points (please correct me
> if I'm wrong):
>
> [1] Visually scanning for _ or __ is hard, and _ are __ hard to
> distinguish from each other.
>
> Personally, I find it easy to scan for them, but I think I can see whee
> you're coming from. Python tends to prefer words and tends to dislike
> symbols compared to e.g. C, C++, and certainly Perl. One could argue
> that using _ or __ goes against that, though to me it's not a problem.
> We're still very far from Perl's line noise.
> It's true that _ and __ can be difficult to be distinguished from each
> other, but that's also not a problem to me, since I don't care about
> their values.
>
>
> [2] Inevitably, sooner or later someone somewhere will start using _ or
> __ despite the fact that by convention they should not be used.
>
> I have to admit that I have no experience programming in larger teams,
> and was blissfully unaware of the problems you describe. I think I can
> see how it might be better to avoid __ rather than try to enforce good
> coding discipline.
>
>
> I still feel __ to be valuable, but I can see now where your dislike for
> it is coming from. Thank you for your insights!
>

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.

So even if you don't have any coworkers, you might trip on someone 
else's assumptions.

To see what I'm talking about:

 >>> 3*4
12
 >>> print(_)
12



> Best regards,
> Roel
>


-- 
DaveA


More information about the Tutor mailing list