473,915 Members | 3,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bug in handling of single underscore identifiers?

Today I installed the 'mechanoid' package from sourceforge, but the
self-test failed. On looking into it, I noticed odd behaviour in the
handling of single underscore module names. Importing into the
current namespace with 'from' seems to work, but accessing members of
the imported module only works if the imported name is qualified by
the containing module name.

For example:
from mechanoid import _mechanoid_Comm on
from _mechanoid_Comm on import Common Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named _mechanoid_Comm on from mechanoid._mech anoid_Common import Common **succeeds** _mechanoid_Comm on

<module 'mechanoid._mec hanoid_Common' from
'mechanoid\_mec hanoid_Common.p yc'>

Is this a bug or a feature? The language reference section 2.3.2
'Reserved classes of identifiers' indicates that identifiers starting
with a single underscore are not imported by "from module import *".
However I can't find any indication that "from module import _name"
should work this way.

Thanks

Tom
Jul 18 '05 #1
0 1142

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2260
by: jason | last post by:
Is there an elegant way to check for the REFERENTIAL INTEGRITY VIOLATION in Access via ASP. The reason I ask is that if the user attempts to refresh the screen after implementing an INSERT he will be trying to insert an identical record which thows up the following error (below). I could place On error resume next before but I find this dangerous or am I overworrying. I could preface the insert by doing a check for the record but this...
8
2012
by: Joe Van Meer | last post by:
Hi all, Been a while since I've done any asp coding, but happy to be getting back into it. My question is what is the best way (now) to handle apostrophes coming in from forms and going into the database? I remember I used to use a replace function replacing single quotes with two single quotes in one of my old apps. Is this still the best way, use this function on all fields I think an apostrophe may come in, or on all fields? Or...
5
4466
by: Frame | last post by:
I'm looking for tutorials or articles considering HTML Frames and how to handle them with Javascript. E.g. samples how Frames can exchange information, can a Frame instruct other Frame to update it's content etc. This kind of information is welcome. Cheers!
7
2593
by: Spacen Jasset | last post by:
The main two desirable things I feel error handling should provide are these: 1) Debugging and diagnostic aid 2) User feedback One method that is used a fair amount it to 'say' that all functions must return an error code of a standard type, for example tError. Where tError is typedefed as a long int. A list of error codes may then be defined in a global header file, or perhaps upper bits of tError may indicate a module
16
3396
by: Jim Langston | last post by:
I know that functions starting with an underscore, or two underscores, are reserved by the compiler/c++ and should not be used by the user and may cause undefined behavior. My question is, how likely is it to actually cause undefined behavior? The reason I'm asking is I'm using a game engine where the sockets code is not working correctly on my computer, but seems to work correctly on everyone elses. I am not compiling the dll myself,...
11
1782
by: Andrew Poelstra | last post by:
I hammered this out this morning to fix inconsistancies with the way my programs handle errors. The code itself is fine, in that it compiles with Richard Heathfield's gcc tags (plus -c because it doesn't have a main). Any comments? /* Start of header */ #ifndef _ERROR_H_ #define _ERROR_H_
8
1462
by: Bill Pursell | last post by:
This question must be FAQ, but I can't find it: I'm baffled by the following: $ cat a.c #define foo(x) foo##x_ #define bar(x) bar##x##_ foo() foo(1) bar()
2
557
by: deepaksrivastav | last post by:
Hi, I am using my own exception handler whose code is as shown below. struct EXCEPTION_REGISTRATION { EXCEPTION_REGISTRATION *prev; DWORD handler; }; EXCEPTION_DISPOSITION myHandler(_EXCEPTION_RECORD *ExcRecord, void *EstablisherFrame, _CONTEXT *ContextRecord,void * DispatcherContext)
6
1358
by: jma | last post by:
Hi all, I want to push some errors on an error stack in my function. The first parameter of the push function is the name of the function where the error occured. For example: int MyFunction() { ... if(error1) pushError("MyFunction","Something is wrong");
0
9883
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11359
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10928
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9734
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8102
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7259
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4779
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4346
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.