On 28Dec2019 19:19, Tim Chase wrote:
Inside a class, I tend to roughly follow
__new__ (if present)
__init__
other dunder methods
subsequent methods alphabetically
I put the factory methods up near __init__, ahead of other methods. But
after most dunders. Here I mean things like this:
On 29Dec2019 09:49, Chris Angelico wrote:
"Define before use" is a broad principle that I try to follow, even
when the code itself doesn't mandate this. This generally means that
"if name is main" is the very last thing in the file, and if there's a
main() function or equivalent, that's usually
On 29/12/19 5:14 AM, Dan Sommers wrote:
On 12/28/19 12:29 AM, Mahmood Naderan via Python-list wrote:
Hi
I have some lines in a text file like
ADD R1, R2
ADD3 R4, R5, R6
ADD.MOV R1, R2, [0x10]
If I grep words with this code
for line in fp:
if my_word in line:
Then if my_word is "ADD", I get
On 29/12/19 2:19 PM, Tim Chase wrote:
On 2019-12-29 12:52, Greg Ewing wrote:
I tend to do this too, although it's probably just a habit
carried over from languages such as Pascal and C where you
have to go out of your way to get things in a different
order.
Apparently I'm not alone in my Pasca
"Define before use" is a broad principle that I try to follow, even
when the code itself doesn't mandate this.
IMO it makes the code easier to navigate even when it's not strictly
necessary. As others have said, Python mandates that the functions be
defined before they're CALLED, but I find that
On 2019-12-29 12:52, Greg Ewing wrote:
> On 29/12/19 11:49 am, Chris Angelico wrote:
> > "Define before use" is a broad principle that I try to follow,
> > even when the code itself doesn't mandate this.
>
> I tend to do this too, although it's probably just a habit
> carried over from languages
On 12/28/19 6:52 PM, Greg Ewing wrote:
> On 29/12/19 11:49 am, Chris Angelico wrote:
>> "Define before use" is a broad principle that I try to follow, even
>> when the code itself doesn't mandate this.
> But strangely, I tend to do the opposite for methods of a class. I
> don't really know why.
On Sun, Dec 29, 2019 at 10:56 AM Greg Ewing wrote:
>
> On 29/12/19 11:49 am, Chris Angelico wrote:
> > "Define before use" is a broad principle that I try to follow, even
> > when the code itself doesn't mandate this.
>
> I tend to do this too, although it's probably just a habit
> carried over fr
On 29/12/19 11:49 am, Chris Angelico wrote:
"Define before use" is a broad principle that I try to follow, even
when the code itself doesn't mandate this.
I tend to do this too, although it's probably just a habit
carried over from languages such as Pascal and C where you
have to go out of your
On 29/12/19 11:35 am, DL Neil wrote:
if our mythical collection of
module-functions has an internal-reference, eg b() requires a(), then
function a() MUST exist, ie be defined, 'before' function b().
Not true in Python -- a() must exist by the time b() is run,
but they can be written in the fi
On 12/28/19 5:35 PM, DL Neil via Python-list wrote:
Is it helpful to, and thus, do you have a style/convention for
ordering the methods within each class in your code?
Python's "honking great idea" of namespaces enables us to gather
functions/methods under a single name-umbrella, thereby avoi
On Sun, Dec 29, 2019 at 9:37 AM DL Neil via Python-list
wrote:
>
> Is it helpful to, and thus, do you have a style/convention for ordering
> the methods within each class in your code?
>
> A major difference however, is that if our mythical collection of
> module-functions has an internal-referenc
Is it helpful to, and thus, do you have a style/convention for ordering
the methods within each class in your code?
Python's "honking great idea" of namespaces enables us to gather
functions/methods under a single name-umbrella, thereby avoiding
name-clashes/name-space 'pollution'. [Oh yeah!]
On 12/28/2019 5:52 AM, L A Smit wrote:
Hi
Don't know if this is the correct subject but i want a program like an
invoice, You make an invoice and save it and the next one is ready to
use. I am completely new to programming and want this program for myself.
I want to use python to do it. Hav
On 12/28/19 12:29 AM, Mahmood Naderan via Python-list wrote:
Hi
I have some lines in a text file like
ADD R1, R2
ADD3 R4, R5, R6
ADD.MOV R1, R2, [0x10]
If I grep words with this code
for line in fp:
if my_word in line:
Then if my_word is "ADD", I get 3 matches. However, if I grep word with t
On 12/28/19 12:29 AM, Mahmood Naderan via Python-list wrote:
Hi
I have some lines in a text file like
ADD R1, R2
ADD3 R4, R5, R6
ADD.MOV R1, R2, [0x10]
If I grep words with this code
for line in fp:
if my_word in line:
Then if my_word is "ADD", I get 3 matches. However, if I grep word with t
>
>
> I have some lines in a text file like
> ADD R1, R2
> ADD3 R4, R5, R6
> ADD.MOV R1, R2, [0x10]
>
Actually I want to get 2 matches. ADD R1, R2 and ADD.MOV R1, R2, [0x10]
> because these two lines are actually "ADD" instructions. However, "ADD3" is
> something else.
>
>>> s = """ADD R1, R
Hi
Don't know if this is the correct subject but i want a program like an
invoice, You make an invoice and save it and the next one is ready to
use. I am completely new to programming and want this program for myself.
I want to use python to do it. Have already build the program but don't
k
Hi
I have some lines in a text file like
ADD R1, R2
ADD3 R4, R5, R6
ADD.MOV R1, R2, [0x10]
If I grep words with this code
for line in fp:
if my_word in line:
Then if my_word is "ADD", I get 3 matches. However, if I grep word with this
code
for line in fp:
for word in line.split():
19 matches
Mail list logo