473,698 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unicode docstrings in PyMethodDef?

Hi folks

I'm currently working on a fairly well internationalis ed app that embeds
a Python intepreter. I'd like to make the docstrings translatable, but
am running into the issue that the translation function returns unicode
data.

Does anybody here know what encoding docstrings in PyMethodDef are
interpreted as? Is there any sane way to get unicode data into
docstrings for methods provided by extension modules?

I'm hoping to avoid writing a Python wrapper module if at all possible,
especially since that'll make it impossible to use the Qt translation
system the rest of the app is translated with.

--
Craig Ringer

Jul 18 '05 #1
0 1250

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

Similar topics

2
3384
by: Sridhar R | last post by:
When writing a python library, we can use docstrings for methods and functions that are part of API. But what about comments for non-API objects or python application code? For applications, docstrings are not really much useful. Instead language comments are prefered for them. Language comments (starting with #) are usually considered to be a little more readable than docstrings (when reading the source code for understanding it).
2
1835
by: Steven Bethard | last post by:
I have two classes that implement the same interface, e.g. something like: class C(object): def foo(self): """Foo things""" ... def bar(self): """Bar things""" ... def baz(self):
6
3055
by: Kamilche | last post by:
I have a large project that is getting complex, and I would like to print the docstrings without importing the modules. The only Python utility I could find references is apparently defunct and hasn't been updated in 4 years. I don't care how spartan the output is - it could look exactly like python's internal docstrings, for all I care. It would be a nice added bonus if it printed to HTML, but not if it greatly increased the interface...
0
1092
by: Edward Loper | last post by:
Epydoc 3 supports extracting information about Python modules by parsing. As a result, it can extract "docstrings" for variables. There are several possible ways these docstrings could be expressed in the Python source file, and I wanted to get some feedback on which ways people prefer. It's my hope that some consensus can be reached on this, so that any tools that extract variable docstrings can use the same conventions. The...
12
3129
by: jelle | last post by:
That's basically the idea... Often i find myself annotating what variables actually stand for, so to refer back to the code in half a year or so. # check if ID's or coords self.pointIDs = ptIDs self.coords = # map ids/coords and coords/ids self.pointID_2_Coord, self.coord_2_pointID = {}, {}
0
1210
by: Ben Sizer | last post by:
In following the example given at <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/54352>, I find that if I instead try to create PyMethodDef instances on the stack and create methods that way, rather than providing pointers to a static array of them, executing the method later raises an exception from PyCFunction_Call. Is it required that the PyMethodDef persists throughout the execution of the Python program? If so, why isn't...
1
1656
bartonc
by: bartonc | last post by:
You will be rewarded sooner than you think when you use docstrings to document your classes and functions. Whether you ever intend to publish your work or not, docstrings will help you in several ways. First, let me show you the syntax: def Add(a, b): """Return the sum of two addable types. This is a very simple example of docstring usage.""" return a + b If you get into the habit of jotting down a short description of a...
2
1661
by: Nick Alexander | last post by:
Hello, I am writing a python extension (compiled C code) that defines an extension type with PyNumberMethods. Everything works swimmingly, except I can't deduce a clean way to set the docstring for tp_* methods. That is, I always have type.__long__.__doc__ == 'x.__long__() <==long(x)' which a quick glance at the Python 2.5 source shows is the default.
0
985
by: tjhnson | last post by:
The topic of docstrings for variables has come up many times before. In fact, a PEP was proposed and rejected on this very topic. http://www.python.org/dev/peps/pep-0224/ When creating classes, I like using properties...and I like even more that these properties have docstrings. This allows one to interactively explore the API and understand (in a limited sense) what the variables mean in the context of the class. I am in a situation...
0
9170
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
9031
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
8904
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
7741
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
6531
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
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.