Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 16th, 2001, 12:36 PM
ppkkpp ppkkpp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 ppkkpp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Python code in Zope does not support "_"

It seems that ZOPE does not support Python variables that begins with "_".

I will get an error as such:

"_hi" is an invalid variable name because it starts with "_"


Anyone have any ideas why this is?
Thanks

Reply With Quote
  #2  
Old July 16th, 2001, 01:10 PM
dcaillouet's Avatar
dcaillouet dcaillouet is offline
Big Endian
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: May 2001
Location: Fly-over country
Posts: 1,172 dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 16 h 29 m 5 sec
Reputation Power: 29
I do not know the answer to your question. I was able to find this but don't know if it is related to your problem:

Published objects
Objects are published by including them in a published module.
When a module is published, any objects that:
- can be found in the module's global name space,
- that do not have names starting with an underscore,
- that have non-empty documentation strings, and
- that are not modules
are published.

Reply With Quote
  #3  
Old July 17th, 2001, 05:00 PM
dcaillouet's Avatar
dcaillouet dcaillouet is offline
Big Endian
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: May 2001
Location: Fly-over country
Posts: 1,172 dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 16 h 29 m 5 sec
Reputation Power: 29
I was reading my Core Python Programming book today and came across the following section. Again, I'm uncertain of it's relevance but thought it might help:

Quote:
Preventing Attribute Import
If you do not want module attributes imported when a module is imported with "from module import *", prepend the underscore (_) to their names. Names in the imported module that begin with an underscore (_) are not imported. This minimal level of data hiding does not apply if the entire module is imported.
.
.
.
CORE STYLE: Avoid underscores as leading identifier character
Because of the underscore usage in Python system, interpreter, and built-in identifiers, we recommend that the programmer avoid the use of beginning variable names with the underscore

Reply With Quote
  #4  
Old July 26th, 2001, 12:44 AM
nethomer nethomer is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: New Zealand
Posts: 1 nethomer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Just a bit of history,

Way back before Zope had scripts (pre ver 2.?) the only way to access standard modules such as "string" were thus:

<dtml-var _.string.strip(variable_name_goes_here)>

Not pretty and not much fun!

With the advent of scripts within Zope this is pretty much unnecessary. Obviously they cant remove the code for backwards comaptibility (thankfully or my site would require lots of rework).

Cheers

Martin

NetHomes

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Python code in Zope does not support "_"

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap