Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

Am I not seeing the Error?

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


devyncjohnson at gmail

Aug 10, 2013, 7:19 PM

Post #1 of 21 (51 views)
Permalink
Am I not seeing the Error?

I am checking my 1292-line script for syntax errors. I ran the following
commands in a terminal to check for errors, but I do not see the error.

collier [at] Nacho-Lapto:/media/collier/AI/Pysh$ python3 -m py_compile
./beta_engine
File "./beta_engine", line 344
JOB_WRITEURGFILES =
multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID);
write2file(SENTEMPPATH, ''); write2file(INPUTMEM, ''));
JOB_WRITEURGFILES.start()
^
SyntaxError: invalid syntax
collier [at] Nacho-Lapto:/media/collier/AI/Pysh$ pylint ./beta_engine
No config file found, using default configuration
************* Module beta_engine
E:344,0: invalid syntax


Here is line 344:

JOB_WRITEURGFILES =
multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID);
write2file(SENTEMPPATH, ''); write2file(INPUTMEM, ''));
JOB_WRITEURGFILES.start()

The ENGINEPID is a variable containing a string. My write2file function is

def write2file(openfile, WRITE):
with open(openfile, 'rw') as file:
file.write(WRITE)


Mahalo,

DevynCJohnson [at] Gmail
--
http://mail.python.org/mailman/listinfo/python-list


rosuav at gmail

Aug 10, 2013, 7:33 PM

Post #2 of 21 (50 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On Sun, Aug 11, 2013 at 3:19 AM, Devyn Collier Johnson
<devyncjohnson [at] gmail> wrote:
> am checking my 1292-line script for syntax errors. I ran the following
> commands in a terminal to check for errors, but I do not see the error.
>
> collier [at] Nacho-Lapto:/media/collier/AI/Pysh$ python3 -m py_compile
> ./beta_engine
> File "./beta_engine", line 344
> JOB_WRITEURGFILES =
> multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID);
> write2file(SENTEMPPATH, ''); write2file(INPUTMEM, ''));
> JOB_WRITEURGFILES.start()
> ^
> SyntaxError: invalid syntax


When you get a syntax error you can't understand, look at the previous
line of code. Perhaps something there is incomplete; maybe you have
mismatched parentheses, so this line is considered to be part of the
same expression.

Next thing to do is split it into more lines. Why is all that in a single line?

ChrisA
--
http://mail.python.org/mailman/listinfo/python-list


roy at panix

Aug 10, 2013, 7:43 PM

Post #3 of 21 (50 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

In article <mailman.452.1376188442.1251.python-list [at] python>,
Chris Angelico <rosuav [at] gmail> wrote:

> When you get a syntax error you can't understand, look at the previous
> line of code. Perhaps something there is incomplete; maybe you have
> mismatched parentheses, so this line is considered to be part of the
> same expression.
>
> Next thing to do is split it into more lines. Why is all that in a single
> line?

Also, try reformatting the code in a tool like emacs or eclipse which
does syntax coloring and auto indenting. Often, if you're missing some
piece of punctuation, it will become obvious when your tool tries to
indent things in some unexpected way. Or suddenly starts coloring all
of your program text as if it were a string literal :-)
--
http://mail.python.org/mailman/listinfo/python-list


rosuav at gmail

Aug 10, 2013, 7:47 PM

Post #4 of 21 (50 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On Sun, Aug 11, 2013 at 3:43 AM, Roy Smith <roy [at] panix> wrote:
> In article <mailman.452.1376188442.1251.python-list [at] python>,
> Chris Angelico <rosuav [at] gmail> wrote:
>
>> When you get a syntax error you can't understand, look at the previous
>> line of code. Perhaps something there is incomplete; maybe you have
>> mismatched parentheses, so this line is considered to be part of the
>> same expression.
>>
>> Next thing to do is split it into more lines. Why is all that in a single
>> line?
>
> Also, try reformatting the code in a tool like emacs or eclipse which
> does syntax coloring and auto indenting. Often, if you're missing some
> piece of punctuation, it will become obvious when your tool tries to
> indent things in some unexpected way. Or suddenly starts coloring all
> of your program text as if it were a string literal :-)

Agreed. Though I've had some odd issues with SciTE in that way; I
think its Python handling may have bugs in it here and there. But 95%
of the time it's helpful.

ChrisA
--
http://mail.python.org/mailman/listinfo/python-list


tjreedy at udel

Aug 10, 2013, 8:07 PM

Post #5 of 21 (50 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On 8/10/2013 10:19 PM, Devyn Collier Johnson wrote:
> I am checking my 1292-line script for syntax errors. I ran the following
> commands in a terminal to check for errors, but I do not see the error.
>
> collier [at] Nacho-Lapto:/media/collier/AI/Pysh$ python3 -m py_compile
> ./beta_engine
> File "./beta_engine", line 344
> JOB_WRITEURGFILES =
> multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID);

That should be a comma; so should the next semicolon below.

> write2file(SENTEMPPATH, ''); write2file(INPUTMEM, ''));

This last one is 'correct', but delete it

> JOB_WRITEURGFILES.start()

and put this statement on a line by itself.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


steve+comp.lang.python at pearwood

Aug 11, 2013, 1:28 AM

Post #6 of 21 (42 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On Sun, 11 Aug 2013 03:33:52 +0100, Chris Angelico wrote:

> Next thing to do is split it into more lines. Why is all that in a
> single line?

The only good excuse for writing multiple statements on a single line
separated by semi-colons is if the Enter key on your keyboard is broken.


:-)


--
Steven
--
http://mail.python.org/mailman/listinfo/python-list


joshua at landau

Aug 11, 2013, 3:18 AM

Post #7 of 21 (40 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On 11 August 2013 09:28, Steven D'Aprano
<steve+comp.lang.python [at] pearwood> wrote:
> into more lines. Why is all that in a
>> single line?
>
> The only good excuse for writing multiple statements on a single line
> separated by semi-colons is if the Enter key on your keyboard is broken.

That's not a good excuse.

It *is* a good excuse for any of the following:

* Buying a new keyboard
* Using a new keymap, possibly replacing cAPSLOCK with Return
* Crying
--
http://mail.python.org/mailman/listinfo/python-list


roy at panix

Aug 11, 2013, 6:27 AM

Post #8 of 21 (37 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

In article <52074b43$0$30000$c3e8da3$5496439d [at] news>,
Steven D'Aprano <steve+comp.lang.python [at] pearwood> wrote:

> On Sun, 11 Aug 2013 03:33:52 +0100, Chris Angelico wrote:
>
> > Next thing to do is split it into more lines. Why is all that in a
> > single line?
>
> The only good excuse for writing multiple statements on a single line
> separated by semi-colons is if the Enter key on your keyboard is broken.

Well, maybe if you're testing something on the command line with "python
-c".
--
http://mail.python.org/mailman/listinfo/python-list


devyncjohnson at gmail

Aug 12, 2013, 5:33 AM

Post #9 of 21 (28 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On 08/10/2013 10:47 PM, Chris Angelico wrote:
> On Sun, Aug 11, 2013 at 3:43 AM, Roy Smith <roy [at] panix> wrote:
>> In article <mailman.452.1376188442.1251.python-list [at] python>,
>> Chris Angelico <rosuav [at] gmail> wrote:
>>
>>> When you get a syntax error you can't understand, look at the previous
>>> line of code. Perhaps something there is incomplete; maybe you have
>>> mismatched parentheses, so this line is considered to be part of the
>>> same expression.
>>>
>>> Next thing to do is split it into more lines. Why is all that in a single
>>> line?
>> Also, try reformatting the code in a tool like emacs or eclipse which
>> does syntax coloring and auto indenting. Often, if you're missing some
>> piece of punctuation, it will become obvious when your tool tries to
>> indent things in some unexpected way. Or suddenly starts coloring all
>> of your program text as if it were a string literal :-)
> Agreed. Though I've had some odd issues with SciTE in that way; I
> think its Python handling may have bugs in it here and there. But 95%
> of the time it's helpful.
>
> ChrisA

Thanks everyone. Unfortunately, I have not found the problem yet. I use
the Geany IDE which has syntax highlighting, but nothing wrong is seen.
None of the suggestions helped. The lines before this one set variables.
The lines further up "appear" fine. I will keep looking. If I ever
figure it out, I will share with all of you.

As for the code being one line, my style of coding is very different
from others. I try to keep similar or related tasks on one line.
Programming like that is called trolling. A programmer that uses
trolling is called a troll. A troll can also refer to such a line of
code itself. My scripts contain a lot of trolls. It is easier for me to
read trolls than "typical" coding styles. (Yes, I am a weird troll (^u^))

Mahalo,

DevynCJohnson [at] Gmail
--
http://mail.python.org/mailman/listinfo/python-list


zachary.ware+pylist at gmail

Aug 12, 2013, 6:20 AM

Post #10 of 21 (27 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On Mon, Aug 12, 2013 at 7:33 AM, Devyn Collier Johnson
<devyncjohnson [at] gmail> wrote:
>
> On 08/10/2013 10:47 PM, Chris Angelico wrote:
>>
>> On Sun, Aug 11, 2013 at 3:43 AM, Roy Smith <roy [at] panix> wrote:
>>>
>>> In article <mailman.452.1376188442.1251.python-list [at] python>,
>>> Chris Angelico <rosuav [at] gmail> wrote:
>>>
>>>> When you get a syntax error you can't understand, look at the previous
>>>> line of code. Perhaps something there is incomplete; maybe you have
>>>> mismatched parentheses, so this line is considered to be part of the
>>>> same expression.
>>>>
>>>> Next thing to do is split it into more lines. Why is all that in a
>>>> single
>>>> line?
>>>
>>> Also, try reformatting the code in a tool like emacs or eclipse which
>>> does syntax coloring and auto indenting. Often, if you're missing some
>>> piece of punctuation, it will become obvious when your tool tries to
>>> indent things in some unexpected way. Or suddenly starts coloring all
>>> of your program text as if it were a string literal :-)
>>
>> Agreed. Though I've had some odd issues with SciTE in that way; I
>> think its Python handling may have bugs in it here and there. But 95%
>> of the time it's helpful.
>>
>> ChrisA
>
>
> Thanks everyone. Unfortunately, I have not found the problem yet. I use the
> Geany IDE which has syntax highlighting, but nothing wrong is seen. None of
> the suggestions helped. The lines before this one set variables. The lines
> further up "appear" fine. I will keep looking. If I ever figure it out, I
> will share with all of you.
>
> As for the code being one line, my style of coding is very different from
> others. I try to keep similar or related tasks on one line. Programming like
> that is called trolling. A programmer that uses trolling is called a troll.
> A troll can also refer to such a line of code itself. My scripts contain a
> lot of trolls. It is easier for me to read trolls than "typical" coding
> styles.

Obviously not, since you can't find the syntax error. If you replace
each semicolon in that line with a newline, the syntax error will be
immediately obvious. I'll even give you a hint: it's on the third
line.

--
Zach
--
http://mail.python.org/mailman/listinfo/python-list


ned at nedbatchelder

Aug 12, 2013, 7:01 AM

Post #11 of 21 (27 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On 8/12/13 8:33 AM, Devyn Collier Johnson wrote:
>
> On 08/10/2013 10:47 PM, Chris Angelico wrote:
>> On Sun, Aug 11, 2013 at 3:43 AM, Roy Smith <roy [at] panix> wrote:
>>> In article <mailman.452.1376188442.1251.python-list [at] python>,
>>> Chris Angelico <rosuav [at] gmail> wrote:
>>>
>>>> When you get a syntax error you can't understand, look at the previous
>>>> line of code. Perhaps something there is incomplete; maybe you have
>>>> mismatched parentheses, so this line is considered to be part of the
>>>> same expression.
>>>>
>>>> Next thing to do is split it into more lines. Why is all that in a
>>>> single
>>>> line?
>>> Also, try reformatting the code in a tool like emacs or eclipse which
>>> does syntax coloring and auto indenting. Often, if you're missing some
>>> piece of punctuation, it will become obvious when your tool tries to
>>> indent things in some unexpected way. Or suddenly starts coloring all
>>> of your program text as if it were a string literal :-)
>> Agreed. Though I've had some odd issues with SciTE in that way; I
>> think its Python handling may have bugs in it here and there. But 95%
>> of the time it's helpful.
>>
>> ChrisA
>
> Thanks everyone. Unfortunately, I have not found the problem yet. I
> use the Geany IDE which has syntax highlighting, but nothing wrong is
> seen. None of the suggestions helped. The lines before this one set
> variables. The lines further up "appear" fine. I will keep looking. If
> I ever figure it out, I will share with all of you.
>
As Terry Reedy pointed out, you have semicolons separating arguments in
a function call. This is your line of code:

JOB_WRITEURGFILES =
multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID);
write2file(SENTEMPPATH, ''); write2file(INPUTMEM, ''));
JOB_WRITEURGFILES.start()

Replacing names with shorter ones to see the structure, it's like this:

J = m.P( w('', E); w(S, ''); w(I, '') ); J.s()

You have three semicolons in that line. Two are inside a call, though
I'm not sure that's what you intended. One is separating statements.
You might be a little too attached to your "more readable" style.
Putting things on different lines really does help you see what is going on.

--Ned.

--
http://mail.python.org/mailman/listinfo/python-list


devyncjohnson at gmail

Aug 12, 2013, 7:04 AM

Post #12 of 21 (26 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On 08/12/2013 09:20 AM, Zachary Ware wrote:
> On Mon, Aug 12, 2013 at 7:33 AM, Devyn Collier Johnson
> <devyncjohnson [at] gmail> wrote:
>> On 08/10/2013 10:47 PM, Chris Angelico wrote:
>>> On Sun, Aug 11, 2013 at 3:43 AM, Roy Smith <roy [at] panix> wrote:
>>>> In article <mailman.452.1376188442.1251.python-list [at] python>,
>>>> Chris Angelico <rosuav [at] gmail> wrote:
>>>>
>>>>> When you get a syntax error you can't understand, look at the previous
>>>>> line of code. Perhaps something there is incomplete; maybe you have
>>>>> mismatched parentheses, so this line is considered to be part of the
>>>>> same expression.
>>>>>
>>>>> Next thing to do is split it into more lines. Why is all that in a
>>>>> single
>>>>> line?
>>>> Also, try reformatting the code in a tool like emacs or eclipse which
>>>> does syntax coloring and auto indenting. Often, if you're missing some
>>>> piece of punctuation, it will become obvious when your tool tries to
>>>> indent things in some unexpected way. Or suddenly starts coloring all
>>>> of your program text as if it were a string literal :-)
>>> Agreed. Though I've had some odd issues with SciTE in that way; I
>>> think its Python handling may have bugs in it here and there. But 95%
>>> of the time it's helpful.
>>>
>>> ChrisA
>>
>> Thanks everyone. Unfortunately, I have not found the problem yet. I use the
>> Geany IDE which has syntax highlighting, but nothing wrong is seen. None of
>> the suggestions helped. The lines before this one set variables. The lines
>> further up "appear" fine. I will keep looking. If I ever figure it out, I
>> will share with all of you.
>>
>> As for the code being one line, my style of coding is very different from
>> others. I try to keep similar or related tasks on one line. Programming like
>> that is called trolling. A programmer that uses trolling is called a troll.
>> A troll can also refer to such a line of code itself. My scripts contain a
>> lot of trolls. It is easier for me to read trolls than "typical" coding
>> styles.
> Obviously not, since you can't find the syntax error. If you replace
> each semicolon in that line with a newline, the syntax error will be
> immediately obvious. I'll even give you a hint: it's on the third
> line.
>
Zachary, are you, Ned, and Terry trying to say the syntax should be

job = multiprocessing.Process(func1(), func2())

not

job = multiprocessing.Process(func1(); func2())

DCJ

--
http://mail.python.org/mailman/listinfo/python-list


gordon at panix

Aug 12, 2013, 7:47 AM

Post #13 of 21 (27 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

In <mailman.451.1376187574.1251.python-list [at] python> Devyn Collier Johnson <devyncjohnson [at] gmail> writes:

> I am checking my 1292-line script for syntax errors. I ran the following
> commands in a terminal to check for errors, but I do not see the error.

> File "./beta_engine", line 344
> JOB_WRITEURGFILES =
> multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID);

You have too many ('s this line.

> write2file(SENTEMPPATH, ''); write2file(INPUTMEM, ''));

And too many )'s on this one.

--
John Gordon A is for Amy, who fell down the stairs
gordon [at] panix B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

--
http://mail.python.org/mailman/listinfo/python-list


zachary.ware+pylist at gmail

Aug 12, 2013, 8:37 AM

Post #14 of 21 (22 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On Mon, Aug 12, 2013 at 9:04 AM, Devyn Collier Johnson
<devyncjohnson [at] gmail> wrote:
>
> Zachary, are you, Ned, and Terry trying to say the syntax should be
>
> job = multiprocessing.Process(func1(), func2())
>
> not
>
> job = multiprocessing.Process(func1(); func2())
>

Basically, yes. The first option there is equivalent to this:

func_returns = (func1(), func2())

job = multiprocessing.Process(*func_returns)

The second option is equivalent to this:

job = multiprocessing.Process(func1()

func2())

...which is actually several different syntax errors, depending on how
you look at it. Semi-colon is only ever used in Python as a
substitute for \n-plus-some-spaces. And, since in your original
example, your semi-colons are inside parenthesis, they really have no
effect at all due to implicit line continuation within parens. So
your original line:

JOB_WRITEURGFILES =
multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID);
write2file(SENTEMPPATH, ''); write2file(INPUTMEM, ''));
JOB_WRITEURGFILES.start()

is really:

JOB_WRITEURGFILES =
multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID)
write2file(SENTEMPPATH, '') write2file(INPUTMEM, ''))

JOB_WRITEURGFILES.start()

It should be obvious now that the syntax error comes from not
separating the arguments to Process.

Trying to read between the lines a little here, I don't think you have
quite figured out how multiprocessing.Process works; that first option
above will only work if func1 returns None and func2 returns a
callable object and the second has no hope. I think this is more
along the lines of what you're really after:

def process_func():
func1()
func2()

if __name__ == '__main__':
job = multiprocessing.Process(target=process_func) # note: no
() after process_func!
job.start()

I'd suggest giving the multiprocessing.Process docs [0] a good
read-through. Keep in mind that Process is just a type like any other
(str, int, list, etc.), and calling its constructor is subject to the
same rules as any other function call.


--
Zach

[0] http://docs.python.org/3/library/multiprocessing#the-process-class
--
http://mail.python.org/mailman/listinfo/python-list


zachary.ware+pylist at gmail

Aug 12, 2013, 8:47 AM

Post #15 of 21 (22 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On Mon, Aug 12, 2013 at 10:37 AM, Zachary Ware
<zachary.ware+pylist [at] gmail> wrote:
> [snip my last reply with a few code samples]

My apologies for Gmail's mangling of my samples. Any code that is not
indented should be on the previous line.

--
Zach
--
http://mail.python.org/mailman/listinfo/python-list


roy at panix

Aug 12, 2013, 8:47 AM

Post #16 of 21 (22 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

I can't quite sort out the multiple quoting levels, but somebody said:

>>> Programming like that is called trolling. A programmer that uses
>>> trolling is called a troll. A troll can also refer to such a line
>>> of code itself. My scripts contain a lot of trolls. It is easier
>>> for me to read trolls than "typical" coding styles.

Please tell me this is all just an elaborate joke.
--
http://mail.python.org/mailman/listinfo/python-list


joel.goldstick at gmail

Aug 12, 2013, 9:56 AM

Post #17 of 21 (22 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On Mon, Aug 12, 2013 at 11:47 AM, Roy Smith <roy [at] panix> wrote:
> I can't quite sort out the multiple quoting levels, but somebody said:
>
>>>> Programming like that is called trolling. A programmer that uses
>>>> trolling is called a troll. A troll can also refer to such a line
>>>> of code itself. My scripts contain a lot of trolls. It is easier
>>>> for me to read trolls than "typical" coding styles.
>
> Please tell me this is all just an elaborate joke.

I was thinking something similar Roy. Devyn, you may think you code
differently, but you don't. You have a half of dozen people trying to
show you how your style causes confusion between what you think you
are writing and what you actually coded. There is plenty of room in
coding for personal expression, but what you call 'trolling' is not
that. If you like semicolons, use another language that needs them.
I think you think it is some version of premature optimization. Since
you are a novice at the language, stick with the standards, and learn
to embrace them. Ultimately standard coding styles has nothing to do
with code optimization. It has to do with readability. Although this
is a small example, you can see that if several people get involved
debugging it, the first thing that gets in the way is your
non-standard coding style. If you want to code alone your whole life,
do as you like. But the time spent reading and fixing code in the
lifetime of any useful software system is greater than the time spent
creating the original code.
> --
> http://mail.python.org/mailman/listinfo/python-list



--
Joel Goldstick
http://joelgoldstick.com
--
http://mail.python.org/mailman/listinfo/python-list


rosuav at gmail

Aug 12, 2013, 10:19 AM

Post #18 of 21 (16 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On Mon, Aug 12, 2013 at 5:56 PM, Joel Goldstick
<joel.goldstick [at] gmail> wrote:
> If you like semicolons, use another language that needs them.
> I think you think it is some version of premature optimization. Since
> you are a novice at the language, stick with the standards, and learn
> to embrace them.

I'm a C programmer who really likes his semicolons, and I often write
long lines. But I still was right up there early on saying "split this
line". It definitely wants to be split. And when *I* say that, it must
be pretty notably splittable. :)

ChrisA
--
http://mail.python.org/mailman/listinfo/python-list


devyncjohnson at gmail

Aug 12, 2013, 1:16 PM

Post #19 of 21 (14 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On 08/12/2013 12:56 PM, Joel Goldstick wrote:
> On Mon, Aug 12, 2013 at 11:47 AM, Roy Smith <roy [at] panix> wrote:
>> I can't quite sort out the multiple quoting levels, but somebody said:
>>
>>>>> Programming like that is called trolling. A programmer that uses
>>>>> trolling is called a troll. A troll can also refer to such a line
>>>>> of code itself. My scripts contain a lot of trolls. It is easier
>>>>> for me to read trolls than "typical" coding styles.
>> Please tell me this is all just an elaborate joke.
> I was thinking something similar Roy. Devyn, you may think you code
> differently, but you don't. You have a half of dozen people trying to
> show you how your style causes confusion between what you think you
> are writing and what you actually coded. There is plenty of room in
> coding for personal expression, but what you call 'trolling' is not
> that. If you like semicolons, use another language that needs them.
> I think you think it is some version of premature optimization. Since
> you are a novice at the language, stick with the standards, and learn
> to embrace them. Ultimately standard coding styles has nothing to do
> with code optimization. It has to do with readability. Although this
> is a small example, you can see that if several people get involved
> debugging it, the first thing that gets in the way is your
> non-standard coding style. If you want to code alone your whole life,
> do as you like. But the time spent reading and fixing code in the
> lifetime of any useful software system is greater than the time spent
> creating the original code.
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>
>

I know using semicolons will not optimize the code, but it is actually
easier for me to read. I can handle such code better than spacing it out.

DCJ
--
http://mail.python.org/mailman/listinfo/python-list


joel.goldstick at gmail

Aug 12, 2013, 1:34 PM

Post #20 of 21 (14 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On Mon, Aug 12, 2013 at 4:16 PM, Devyn Collier Johnson
<devyncjohnson [at] gmail> wrote:
>
> On 08/12/2013 12:56 PM, Joel Goldstick wrote:
>>
>> On Mon, Aug 12, 2013 at 11:47 AM, Roy Smith <roy [at] panix> wrote:
>>>
>>> I can't quite sort out the multiple quoting levels, but somebody said:
>>>
>>>>>> Programming like that is called trolling. A programmer that uses
>>>>>> trolling is called a troll. A troll can also refer to such a line
>>>>>> of code itself. My scripts contain a lot of trolls. It is easier
>>>>>> for me to read trolls than "typical" coding styles.
>>>
>>> Please tell me this is all just an elaborate joke.
>>
>> I was thinking something similar Roy. Devyn, you may think you code
>> differently, but you don't. You have a half of dozen people trying to
>> show you how your style causes confusion between what you think you
>> are writing and what you actually coded. There is plenty of room in
>> coding for personal expression, but what you call 'trolling' is not
>> that. If you like semicolons, use another language that needs them.
>> I think you think it is some version of premature optimization. Since
>> you are a novice at the language, stick with the standards, and learn
>> to embrace them. Ultimately standard coding styles has nothing to do
>> with code optimization. It has to do with readability. Although this
>> is a small example, you can see that if several people get involved
>> debugging it, the first thing that gets in the way is your
>> non-standard coding style. If you want to code alone your whole life,
>> do as you like. But the time spent reading and fixing code in the
>> lifetime of any useful software system is greater than the time spent
>> creating the original code.
>>>
>>> --
>>> http://mail.python.org/mailman/listinfo/python-list
>>
>>
>>
>
> I know using semicolons will not optimize the code, but it is actually
> easier for me to read. I can handle such code better than spacing it out.

Except it doesn't make it easier to read.


JOB_WRITEURGFILES =
multiprocessing.Process(write2file('./mem/ENGINE_PID', ENGINEPID);
write2file(SENTEMPPATH, ''); write2file(INPUTMEM, ''));
JOB_WRITEURGFILES.start()

As I understand it the above line of code caused you problems. I
don't know what muliprocessing.Process() is supposed to have as
arguments, but I don't think is can have arguments with semicolons,
unless they appeared in a string.

So your semicolons, that you insist make your code easier to read,
have made code that doesn't work, and you don't know why. All I am
saying is you are stating a fact not in evidence. You only think the
semicolons are useful because you haven't taken the time to read and
write enough python code to appreciate that they are not only not
helpful, but they serve no useful purpose. Sure, they allow you to
put several statements on a single line. But that isn't what you were
doing.

good luck. I can see you are interested. keep at it.




>
> DCJ
> --
> http://mail.python.org/mailman/listinfo/python-list



--
Joel Goldstick
http://joelgoldstick.com
--
http://mail.python.org/mailman/listinfo/python-list


ned at nedbatchelder

Aug 12, 2013, 1:35 PM

Post #21 of 21 (14 views)
Permalink
Re: Am I not seeing the Error? [In reply to]

On 8/12/13 4:16 PM, Devyn Collier Johnson wrote:
>
> On 08/12/2013 12:56 PM, Joel Goldstick wrote:
>> On Mon, Aug 12, 2013 at 11:47 AM, Roy Smith <roy [at] panix> wrote:
>>> I can't quite sort out the multiple quoting levels, but somebody said:
>>>
>>>>>> Programming like that is called trolling. A programmer that uses
>>>>>> trolling is called a troll. A troll can also refer to such a line
>>>>>> of code itself. My scripts contain a lot of trolls. It is easier
>>>>>> for me to read trolls than "typical" coding styles.
>>> Please tell me this is all just an elaborate joke.
>> I was thinking something similar Roy. Devyn, you may think you code
>> differently, but you don't. You have a half of dozen people trying to
>> show you how your style causes confusion between what you think you
>> are writing and what you actually coded. There is plenty of room in
>> coding for personal expression, but what you call 'trolling' is not
>> that. If you like semicolons, use another language that needs them.
>> I think you think it is some version of premature optimization. Since
>> you are a novice at the language, stick with the standards, and learn
>> to embrace them. Ultimately standard coding styles has nothing to do
>> with code optimization. It has to do with readability. Although this
>> is a small example, you can see that if several people get involved
>> debugging it, the first thing that gets in the way is your
>> non-standard coding style. If you want to code alone your whole life,
>> do as you like. But the time spent reading and fixing code in the
>> lifetime of any useful software system is greater than the time spent
>> creating the original code.
>>> --
>>> http://mail.python.org/mailman/listinfo/python-list
>>
>>
>
> I know using semicolons will not optimize the code, but it is actually
> easier for me to read. I can handle such code better than spacing it out.
There's no point debating the readability of code that doesn't work.
Get it functioning first, then let's talk about how best to format it.

--Ned.

>
> DCJ

--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.