By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,222 Members | 2,416 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,222 IT Pros & Developers. It's quick & easy.

can't assign to literal

P: n/a
this is stopping my program from running properly. is there something
wrong in my code when that happens?
Jun 27 '08 #1
Share this Question
Share on Google+
16 Replies


P: n/a
On Jun 10, 12:53*pm, maehhheeyy <maehhhe...@gmail.comwrote:
this is stopping my program from running properly. is there something
wrong in my code when that happens?
yes

Post your code, or at least the full error message if you want more
details.

Matt
Jun 27 '08 #2

P: n/a
On Jun 10, 1:21*pm, Matimus <mccre...@gmail.comwrote:
On Jun 10, 12:53*pm, maehhheeyy <maehhhe...@gmail.comwrote:
this is stopping my program from running properly. is there something
wrong in my code when that happens?

yes

Post your code, or at least the full error message if you want more
details.

Matt
for 1 in oids, vals head_oids:
SyntaxError: can't assign to literal
Jun 27 '08 #3

P: n/a
On Tue, Jun 10, 2008 at 5:30 PM, maehhheeyy <ma********@gmail.comwrote:
On Jun 10, 1:21 pm, Matimus <mccre...@gmail.comwrote:
>On Jun 10, 12:53 pm, maehhheeyy <maehhhe...@gmail.comwrote:
this is stopping my program from running properly. is there something
wrong in my code when that happens?

yes

Post your code, or at least the full error message if you want more
details.

Matt

for 1 in oids, vals head_oids:
SyntaxError: can't assign to literal
--
http://mail.python.org/mailman/listinfo/python-list
Wow.
http://catb.org/~esr/faqs/smart-questions.html
Jun 27 '08 #4

P: n/a
maehhheeyy wrote:
On Jun 10, 1:21 pm, Matimus <mccre...@gmail.comwrote:
>On Jun 10, 12:53 pm, maehhheeyy <maehhhe...@gmail.comwrote:
>>this is stopping my program from running properly. is there something
wrong in my code when that happens?
yes

Post your code, or at least the full error message if you want more
details.

Matt

for 1 in oids, vals head_oids:
SyntaxError: can't assign to literal

That statement makes no sense (thus SyntaxError).

for 1 (one) in oids, vals head_oids:

has several problems:

1 - for source variable can't be a number it has to be a name

in oids, vals head_ioids can't be for target as it is at least two and maybe
three different variables (I'm confused because oids <commavals <space>
head_oids) is a second syntax error. You probably need to go back and review
the Python tutorial to get the syntax of a for loop set in your mind properly.

-Larry
Jun 27 '08 #5

P: n/a
>
for 1 in oids, vals head_oids:
SyntaxError: can't assign to literal
--
1 is a literal, you can't assign it to something. Are you trying to
use it as a variable name?
Jun 27 '08 #6

P: n/a
On Jun 10, 10:57 pm, "Steven Clark" <steven.p.cl...@gmail.comwrote:
for 1 in oids, vals head_oids:
SyntaxError: can't assign to literal
--

1 is a literal, you can't assign it to something. Are you trying to
use it as a variable name?
Slightly OT, but is there an editor that can display digits in a
different colour to letters?
Jun 27 '08 #7

P: n/a
On Jun 11, 10:32*am, MRAB <goo...@mrabarnett.plus.comwrote:
On Jun 10, 10:57 pm, "Steven Clark" <steven.p.cl...@gmail.comwrote:
for 1 in oids, vals head_oids:
SyntaxError: can't assign to literal
--
1 is a literal, you can't assign it to something. Are you trying to
use it as a variable name?

Slightly OT, but is there an editor that can display digits in a
different colour to letters?
SciTE and Notepad++ which are just 2 of the editors installed on my PC
currently.
Jun 27 '08 #8

P: n/a
Lie
On Jun 11, 3:32*pm, MRAB <goo...@mrabarnett.plus.comwrote:
On Jun 10, 10:57 pm, "Steven Clark" <steven.p.cl...@gmail.comwrote:
for 1 in oids, vals head_oids:
SyntaxError: can't assign to literal
--
1 is a literal, you can't assign it to something. Are you trying to
use it as a variable name?

Slightly OT, but is there an editor that can display digits in a
different colour to letters?
Most programmer oriented editors could, some even have full syntax
coloring, they would color keywords (like def, class, etc), literals
(1, 'hello', etc), and commonly used built-in function (int, ord,
iter, etc). It really helped if you have to read/write lots of codes
Jun 27 '08 #9

P: n/a
Lie
On Jun 11, 2:53*am, maehhheeyy <maehhhe...@gmail.comwrote:
this is stopping my program from running properly. is there something
wrong in my code when that happens?
That simply means you did something like this:
'hello' = 'another'
123 = 'kilo'
[12, 'asd] = 123

Sometimes it's not that obvious (although they're obvious for a more
experienced programmers):
for 123 in xrange(10):
pass

I think you've realized what you've done. And there is a pretty
obvious signal that hints that you didn't know the basic syntax of
python (or at least the basic syntax of the for-loop).
Jun 27 '08 #10

P: n/a
On 16:47, mercoledì 11 giugno 2008 Chris wrote:
SciTE and Notepad++
Pype, spe, just to point it out. Jedit, but rather a bloatware.
I'd like to know which is the litest multi platform and indipendent.
Pype is very good when compiled in exe, but not doing in Linux in that way.

--
Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html
Jun 27 '08 #11

P: n/a
MRAB wrote:
On Jun 10, 10:57 pm, "Steven Clark" <steven.p.cl...@gmail.comwrote:
>>>for 1 in oids, vals head_oids:
SyntaxError: can't assign to literal
--

1 is a literal, you can't assign it to something. Are you trying to
use it as a variable name?


Slightly OT, but is there an editor that can display digits in a
different colour to letters?
--
http://mail.python.org/mailman/listinfo/python-list
I like Vim (Vi Improved) -- multi-platform, multi-lingual (both spoken
and programmatic), and you can change the existing syntax/color/indent
files or make your own.

http://www.vim.org/
--
Ethan
Jun 27 '08 #12

P: n/a
On 00:15, giovedì 12 giugno 2008 Ethan Furman wrote:
I like Vim (Vi Improved)
What about justifying text ?
--
Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html
Jun 27 '08 #13

P: n/a
TheSaint wrote:
On 00:15, giovedì 12 giugno 2008 Ethan Furman wrote:

>>I like Vim (Vi Improved)

What about justifying text ?
Do you mean indenting, or wrapping? Vim has excellent indenting
support, and Python files already included that support proper
indenting, syntax coloring, etc.

I don't use the line-wrapping feature myself, so I have no experience
with it.
--
Ethan
Jun 27 '08 #14

P: n/a
On 15:11, giovedì 12 giugno 2008 Dennis Lee Bieber wrote:
Word spaced line justification is only feasible if one is using a
fixed width font and have a line length defined in "characters/line".
===8<======8<======8<======8<======8<======8<===== =8<======8<======8<======8<

line= 'fixed width font and have a line length defined in "characters/line".'

lenLine= 78; newLine= ''; Words= line.split(' ')
lnWords= len(Words); norm_spc= lnWords-1; xtr_spc = lenLine -len(line)
lenChr= len(line)-norm_spc
numspc= (norm_spc+ xtr_spc)/ norm_spc
lstword= len(Words[norm_spc])
for spc in range(lnWords):
if len(newLine)+lstword + numspc lenLine : break
newLine += Words[spc]+(' '* numspc)
if xtr_spc:
newLine += ' '; xtr_spc -= 1
print newLine+ ' '+ Words[spc]

===8<======8<======8<======8<======8<======8<===== =8<======8<======8<======8<

In my mind it took me just few seconds :), but to get it working I spent
nearly *one* hour. I admit that my skill lacks of knowledge ])
--
Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html
Jun 27 '08 #15

P: n/a
On 14:49, giovedì 12 giugno 2008 Chris wrote:
You should strip all extraneous white space from code though.
For my taste, trailing spaces will be removed by my editor (Kate :) )
Other space tabulators are an issue which won't suite my needs.

--
Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html
Jun 27 '08 #16

P: n/a
On 17:06, venerdì 13 giugno 2008 Dennis Lee Bieber wrote:
-=-=-=-=-=-=- (make sure you have a fixed width client)
Very good indeed :) Specially to do with block reformatting.
I just post my script to demonstrate my thoughts in what I meant as
justifying. Specially considering that I meant character justification
regardless of its width. Monospace chars will show pretty alignment.

BTW, I'm beginner and my coding takes much try-and-test. ;)
--
Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html
Jun 27 '08 #17

This discussion thread is closed

Replies have been disabled for this discussion.