Re: Syntax error: "can't assign to operator"

2008-07-07 Thread bruno desthuilliers


On 5 juil, 04:33, Leaf <[EMAIL PROTECTED]> wrote:
> Okay. I'll run a quick find-and-replace to set all my identifiers to
> use underscores instead of hyphens. I'm not that familiar with Python,
> so I assumed that it would recognize hyphens as a seperator and not a
> minus sign.

There are very few programming languages that allow hyphens or other
special chars in identifiers.

(snip)
> > > class Style(models.Model):
> > > Style-Name = models.CharField("Style Name", Max_length = 32,
> > > Default = "Styles Upon Styles", Help_text = "A user-friendly name for
> > > the style.")

And while we're at it, the naming conventions in Python are
"all_lower_with_underscore" for anything else than class names.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Syntax error: "can't assign to operator"

2008-07-04 Thread Leaf

Okay. I'll run a quick find-and-replace to set all my identifiers to
use underscores instead of hyphens. I'm not that familiar with Python,
so I assumed that it would recognize hyphens as a seperator and not a
minus sign.

Regards,
Leaf

On Jul 4, 10:27 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2008-07-04 at 19:24 -0700, Leaf wrote:
> > I'm still working on the models.py for Dj Styles. I'm trying to create
> > a "Style" class, and the part of my code in question looks something
> > like this:
>
> > class Style(models.Model):
> >     Style-Name = models.CharField("Style Name", Max_length = 32,
> > Default = "Styles Upon Styles", Help_text = "A user-friendly name for
> > the style.")
>
> > Before resyncing the database, I hit the "Check Syntax" button in
> > PythonWin, and it returned "syntax error - can't assign to operator
> > (models.py, line 37)". Line 37 is the one beginning with Style-Name. I
> > tried searching the Internet for the syntax error, but couldn't find
> > anything that was particularly helpful. Does anyone know what's wrong
> > with my code that could be causing this error?
>
> Python thinks "Style-Name" is "Style - Name". You cannot use hyphens in
> identifiers. Looks like you need to slow down and take care that your
> Python is valid when you see these sorts of error messages.
>
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Syntax error: "can't assign to operator"

2008-07-04 Thread Malcolm Tredinnick


On Fri, 2008-07-04 at 19:24 -0700, Leaf wrote:
> I'm still working on the models.py for Dj Styles. I'm trying to create
> a "Style" class, and the part of my code in question looks something
> like this:
> 
> class Style(models.Model):
> Style-Name = models.CharField("Style Name", Max_length = 32,
> Default = "Styles Upon Styles", Help_text = "A user-friendly name for
> the style.")
> 
> Before resyncing the database, I hit the "Check Syntax" button in
> PythonWin, and it returned "syntax error - can't assign to operator
> (models.py, line 37)". Line 37 is the one beginning with Style-Name. I
> tried searching the Internet for the syntax error, but couldn't find
> anything that was particularly helpful. Does anyone know what's wrong
> with my code that could be causing this error?

Python thinks "Style-Name" is "Style - Name". You cannot use hyphens in
identifiers. Looks like you need to slow down and take care that your
Python is valid when you see these sorts of error messages.

Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Syntax error: "can't assign to operator"

2008-07-04 Thread Leaf

I'm still working on the models.py for Dj Styles. I'm trying to create
a "Style" class, and the part of my code in question looks something
like this:

class Style(models.Model):
Style-Name = models.CharField("Style Name", Max_length = 32,
Default = "Styles Upon Styles", Help_text = "A user-friendly name for
the style.")

Before resyncing the database, I hit the "Check Syntax" button in
PythonWin, and it returned "syntax error - can't assign to operator
(models.py, line 37)". Line 37 is the one beginning with Style-Name. I
tried searching the Internet for the syntax error, but couldn't find
anything that was particularly helpful. Does anyone know what's wrong
with my code that could be causing this error?

Regards,
Leaf
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---