[issue9285] Add a profile decorator to profile and cProfile
Changes by Fred L. Drake, Jr. <fdr...@gmail.com>: -- nosy: -fdrake ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9285> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29601] Need reST markup for enum types
Fred L. Drake, Jr. added the comment: Is there some special treatment you think should be given to specific enum values as well? -- nosy: +fdrake ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29601> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28617] Why isn't "in" called a comparison operation?
Fred L. Drake, Jr. added the comment: "in" and "not in" are not comparisons, regardless of implementation mechanics (which could change). They aren't really dependent on iteration, though they often correlate with iteration. I'd rather see them described as "containment tests" or something similar. -- nosy: +fdrake ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28617> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19795] Formatting of True/False/None in docs
Fred L. Drake, Jr. added the comment: Without the star would be right. ReST does not support nested markup, and in this case, I don't think it would make sense anyway. -- nosy: +fdrake ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19795> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28278] Make `weakref.WeakKeyDictionary.__repr__` meaningful
Fred L. Drake, Jr. added the comment: I don't recall that the issues discussed here were considered when these classes were added; functionality was the issue at the time. I'm not particularly opposed to adding a more data-ful repr for the weakref-oriented mappings, but I'm not really convinced they'd be all that valuable, either. Interesting mappings are often too well populated to deal with using repr. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28278> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27495] Pretty printing sorting for set and frozenset instances
Fred L. Drake, Jr. added the comment: +1 It could reasonably be argued that not sorting is a bug for already-released 3.x versions. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27495> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Recommended courses/materials for Python/Django course...
Python programmers, Any Python and/or Django courses/materials to recommend? I may be teaching a Python/Django class soon. My client may be willing to jumpstart by buying existing course materials (lecture slides, notes, homeworks, labs, reference links, any other materials). We'll certainly be happy to make use of any free materials. Do you have any Python and/or Django courses/materials to recommend? I've taken a quick look and found: - Main web sites: - [1]http://python.org - [2]https://djangoproject.com (excellent docs and tutorial!) - Free courses: - [3]https://developers.google.com/edu/python - Free/paid courses: - [4]http://learnpythonthehardway.org/book - Books - 2 Scoops of Django - Paid courses: - Coursera - Codecademy - Khan Academy - Udacity - edX - Alison - Lynda - NewCircle.com Any advice? Thanks! --Fred -- Fred Stluka -- [5]mailto:f...@bristle.com -- [6]http://bristle.com/~fred/ Bristle Software, Inc -- [7]http://bristle.com -- Glad to be of service! Open Source: Without walls and fences, we need no Windows or Gates. -- References Visible links 1. http://python.org/ 2. https://djangoproject.com/ 3. https://developers.google.com/edu/python 4. http://learnpythonthehardway.org/book 5. mailto:f...@bristle.com 6. http://bristle.com/~fred/ 7. http://bristle.com/ -- https://mail.python.org/mailman/listinfo/python-list
[issue18085] Verifying refcounts.dat
Fred L. Drake, Jr. added the comment: I don't think this is a duplicate of issue 9755; this relates to verifying the data, and that revolves around possible process improvements. Whether this issue should be closed is tied to whether the file has been verified, as the issue title suggests. I don't know whether Serhiy verified everything when he made his changes or not; that's not explicit in the issue or commit comments. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18085> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9755] Fix refcounting details in Py3k C API documentation
Fred L. Drake, Jr. added the comment: As mentioned in issue 18085, the original file was not generated, but crafted by hand (though I don't think that really matters). -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9755> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23116] Python Tutorial 4.7.1: Improve ask_ok() to cover more input values
Fred L. Drake, Jr. added the comment: +1 for ValueError instead of OSError. -- nosy: +fdrake ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23116> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26526] In parsermodule.c, replace over 2KLOC of hand-crafted validation code, with a DFA
Fred L. Drake, Jr. added the comment: I've read through this, but haven't applied the patch & run tests (that's what buildbots are for). No objections. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26526> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26526] In parsermodule.c, replace over 2KLOC of hand-crafted validation code, with a DFA
Fred L. Drake, Jr. added the comment: I see your message to python-dev, and apologize for taking so long to get to this. I do intend to read through your changes, and hope to be able to make time while I'm at PyCon this coming week. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26526> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26247] Document Chrome/Chromium for python2.7
Fred L. Drake, Jr. added the comment: LGTM Thanks for getting this documented! -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26247> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26247] Document Chrome/Chromium for python2.7
Fred L. Drake, Jr. added the comment: Sorry; I guess I wasn't clear. ``versionadded::`` and ``versionchanged::`` are applied to specific API points (modules, classes, methods, attributes) that are identified structurally in the documentation. That isn't the case for this. While a bit of text noting the addition is less discoverable for documentation processors, I believe it to be sufficient. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26247> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26247] Document Chrome/Chromium for python2.7
Fred L. Drake, Jr. added the comment: The ``versionadded::`` directive should only be used to annotate descriptions of new API entries. While it would be correctly applied to the ``Chrome`` and ``Chromium`` classes, those are not separately documented here, but are only listed in the table. See http://bugs.python.org/issue26366 for further discussion on the use of ``versionadded::``. -- nosy: +fdrake ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26247> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26366] Use “.. versionadded” over “.. versionchanged” where appropriate
Fred L. Drake, Jr. added the comment: For anyone following along only via the tracker, it's worth noting that proposals for new markup are welcome on the docs mailing list. More information is available at: https://mail.python.org/mailman/listinfo/docs -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26366> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26366] Use “.. versionadded” over “.. versionchanged” where appropriate
Fred L. Drake, Jr. added the comment: If no one is planning to propose specific new markup for more fine-grained version annotations, this issue can be closed. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26366> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26366] Use “.. versionadded” over “.. versionchanged” where appropriate
Fred L. Drake, Jr. added the comment: Another reason to value the status-quo in this case is that this isn't just a matter for the Python documentation; it's about the recommended usage for the markup, which is used by many other packages. Questions that should be discussed include: 1. Should we clarify the documentation for the current annotations to the intended use is more consistently understood, or should we leave it as-is? 2. Are other distinct kinds of annotations (such as per-parameter notes) needed? If so, we'll need to consider specific reader / information-content needs and determine how they should be marked using new constructs. This is independent of implementation, which is likely straightforward. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26366> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26366] Use “.. versionadded” over “.. versionchanged” where appropriate
Fred L. Drake, Jr. added the comment: On Fri, Feb 19, 2016 at 10:02 AM, Tony R. <rep...@bugs.python.org> wrote: > Holy crap! You all used to use LaTeX?! :D Python's documentation has a long & colorful history. :-) > Well then, if this is the sort of place where the status quo is sacred, then > there is nothing more to discuss. Status quo is not sacred, but does have some value. Changing how busy people do things is non-trivial. > But if anyone reading this is open to the idea, please re-read my previous > comment in this thread. The quoted LaTeX docs are clear, but I still > believe my “all changes = (deprecated-removed changes) + (added > changes) + (other changes)” interpretation makes more sense than the > LaTeX definition. > > I also think it is more helpful to the *reader*--which, I respectfully > suggest, > should be the basis for any documentation’s guidelines--by marking up > changes according to this grouping. I think we all agree that the documentation is for the reader. > It’s not my desire to be troublesome by making one more appeal. > I simply want to point out that just because somebody wrote the > LaTeX definitions a long time ago doesn’t mean that we cannot > rewrite them. They were written by somebody just like us, after all. As the person who wrote them, I don't consider them sacred or unchangeable. Having some rational basis for whatever we use is good, and it should be clearly documented clearly. > If it’s not obvious by now, I feel strongly about good semantic markup. We're on the same page here. > The purpose of semantic markup is to describe what something *is*. > I just think that changes form a hierarchy, with a generic “change” as > something of the base class, and “deprecated”, “removed”, and “added” > as specializations. Again, agreed. That doesn't imply that the specializations encompass all changes, though. For some, 'versionchanged' is reasonable. Part of the problem is getting the granularity right. The initial intent was that 'version*' were annotations for the enclosing object (function, class, method, etc.). If we want to have something more granular (parameter added / deprecated / whatever), we should have distinct markup for that. That could look something like: .. parameteradded:: alternate 3.6 Further explanation goes here. It's helpful to think of these annotations as pronouns; the antecedent needs to be clear before they can be interpreted correctly. It sounds like that needs to be clarified in the documentation, and possibly provision added for a more fine-grained form of annotation. -Fred -- nosy: +fdrake title: Use “.. versionadded” over “.. versionchanged” where appropriate -> Use “.. versionadded” over “.. versionchanged” where appropriate ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26366> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26329] os.path.normpath("//") returns //
New submission from Fred Rolland: Hi, os.path.normpath("//") returns '//' I would expect to be '/' >>> os.path.normpath("//") '//' >>> os.path.normpath("///") '/' >>> os.path.normpath("") '/' -- components: Library (Lib) messages: 260016 nosy: Fred Rolland priority: normal severity: normal status: open title: os.path.normpath("//") returns // versions: Python 2.7, Python 3.5, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26329> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26094] ConfigParser.get() doc to be updated according to the configparser.py header doc
Changes by Fred L. Drake, Jr. <fdr...@gmail.com>: -- nosy: +fdrake ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26094> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26124] shlex.quote and pipes.quote do not quote shell keywords
Fred L. Drake, Jr. added the comment: It's not at all obvious that the intention is to ensure such an argument should be treated only as a command external to the shell. If an application really wants to ensure the command is not handled as a shell built-in, it should use shell=False. Making this clear in the documentation is reasonable. -- nosy: +fdrake ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26124> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25474] Weird behavior when setting f_trace in a context manager
Fred Gansevles added the comment: Xavier, thanks! you found it. If I look the code again, I see that with zero, one, four and five the context-manager (i.e. Context()) and the target (one .. five) are on the same code-line In the case of two and three they are on a different line. Now, with the dependency of the trace function on the *physical line* it all make sense. Fred. -- status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25474> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25474] Weird behavior when setting f_trace in a context manager
Fred Gansevles added the comment: Xavier, thanks for looking at my post. But, since all six invocations of the context manager are the same - I did an 'ast.parse' and 'ast.dump' and the the six calls were *exactly* the same (save lineno and col_offset) - why does 'zero', 'one', 'four' and 'five' get assigned but 'two' and 'three' not ? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25474> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25474] Weird behavior when setting f_trace in a context manager
New submission from Fred Gansevles: I'm playing with the idea of making a DSL based on anonynous code blocks I discovered that the behaviour of the context manager is different in some cases if there are line-continuations in the 'with' command I've attached a script that reproduces this behaviour. With both Python 2.7.6 and Python 3.4.3 I get the same results. Fred. -- files: as_context.py messages: 253426 nosy: Fred Gansevles priority: normal severity: normal status: open title: Weird behavior when setting f_trace in a context manager type: behavior Added file: http://bugs.python.org/file40858/as_context.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25474> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: My attempts in playing with tail-recursion in python
Hi Thomas, I like what you've been doing. I think it would also be great if the leave the loop detector would be the actual stop condition in the recursion, applied to the arguments of the call. That would of course force you to split the recursive function in two functions: one to detect the stop condition, and another one that makes the next call, but in my opinion, that would make perfect sense. -- https://mail.python.org/mailman/listinfo/python-list
[issue24067] Weakproxy is an instance of collections.Iterator
Fred L. Drake, Jr. added the comment: Clearly I've been away from this code for a long time. The hash support for ref objects is definitely a very special case, only intended to support WeakKeyDictionary. We that class implemented in C, we'd probably want the hash support for refs not to be exposed. You've convinced me hashability for proxies isn't desirable. Let's stick with the status quo on this. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24067 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24067] Weakproxy is an instance of collections.Iterator
Fred L. Drake, Jr. added the comment: I don't see any reason for proxy objects to be less hashable than ref objects. As for the p == p case, where the referent has expired, returning True if p is p seems acceptable (along with False inequalities, and True for other comparisons allowing equality), but anything beyond that seems unwise. Not sure whether that would really be enough to help real use cases. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24067 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24067] Weakproxy is an instance of collections.Iterator
Fred L. Drake, Jr. added the comment: ref objects behave differently: they inherit their referent's hash value when alive, and remember it. proxy objects could be made to behave the same way. They could, yes, but that would break the proxy behavior, and the hash -- equality behavior for mutable objects. In particular, mutable objects can become equal; if the hashes were computed for the proxies before that happened, the hashes would be inappropriate later. That's pretty important. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24067 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22721] pprint output for sets and dicts is not stable
Fred L. Drake, Jr. added the comment: Sorry for the delay. pprint_safe_key.patch looks good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22721 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2174] xml.sax.xmlreader does not support the InputSource protocol
Fred L. Drake, Jr. added the comment: Given that this has languished this long, patching historical releases seems pointless. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2174 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7434] general pprint rewrite
Changes by Fred L. Drake, Jr. fdr...@gmail.com: -- nosy: -fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7434 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2292] Missing *-unpacking generalizations
Changes by Fred L. Drake, Jr. fdr...@gmail.com: -- nosy: -fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2292 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22721] pprint output for sets and dicts is not stable
Fred L. Drake, Jr. added the comment: Sorting by the repr sounds good, but if some dict keys or set members are strings containing single-quotes, the primary sort will be on the type of quote used for the repr, which would be surprising and significantly less useful. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22721 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22721] pprint output for sets and dicts is not stable
Fred L. Drake, Jr. added the comment: Stability in output order from pprint is very useful in doctests (yes, some people write documentation that they test). I think fixing any output stability issues would be very worthwhile. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22721 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7980] time.strptime not thread safe
Fred Wheeler added the comment: This issue should be noted in the documentation of strptime in the time and datetime modules and/or the thread module. As it stands there is no good way for a user of these modules to learn of this problem until one day the right race conditions exist to expose the problem. Perhaps the following notes will do? https://docs.python.org/2/library/time.html#time.strptime Thread safety: The use of strptime is thread safe, but with one important caveat. The first use of strptime is not thread safe because the first use will import _strptime. That import is not thread safe and may throw AttributeError or ImportError. To avoid this issue, import _strptime explicitly before starting threads, or call strptime once before starting threads. https://docs.python.org/2/library/datetime.html (under strptime()) See time.strptime() for important thread safety information. Having just encountered this unusual and undocumented thread safety problem using 2.7.6, I'm wondering if there are other similar lurking thread safety issues that I might only find when the race conditions are just right and my program stops working. -- nosy: +fredwheeler ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7980 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
meta language to define forms
I'm trying to use python classes and members to define complex data entry forms as a meta language The idea is to use a nice clean syntax like Python to define form content, then render it as HTML but only as a review tool for users, The actual rendering would go into a database to let a vendor's tool generate the form in a totally non-standard syntax that's really clunky. I don't have a lot of time or management support to do something elegant like XML and then parse it, I'm thinking more like Class FyFormNumber001(GeneralForm): Section1 = Section(title=Enter Patient Vital Signs) Question1 = NumberQuestion(title=Enter pulse rate, format=%d3) Question2 = Dropdown(title=Enter current status) Question2.choices = [ (1, Alive and Kicking), (2, Comatose), (3, Dead), ...] Of course this is not quite legal python and I have a lot of flexibility in my meta language. The basic model is that a single file would define a form which would have one or more sections, each section would have one or more questions of various types (i.e. checkbox, radio button, text, etc). Sections cannot be nested. I don't have to have a perfect layout, just close enough to get the end users to focus on what they are asking for before we generate the actual code. I tried an HTML WYSIWYG editor but that was too slow and I lost information that I need to retain when the actual form is generated. The biggest problem (to me) is that I have to maintain the order; i.e. the order in which they are coded should be the order in which they are displayed. I'm looking to do about 200 forms, so it is reasonable to invest some time up front to make the process work; meanwhile management wants results yesterday, so I have a trade-off to make. Is there anything out there that would be close or do you have any suggestions. Thanks. -- https://mail.python.org/mailman/listinfo/python-list
[issue20121] quopri_codec newline handling
New submission from Fred Stober: While trying to encode some binary data, I encountered this behaviour of the quopri_codec: '\r\n\n'.encode('quopri_codec').decode('quopri_codec') '\r\n\r\n' '\n\r\n'.encode('quopri_codec').decode('quopri_codec') '\n\n' If this behaviour is really intended, it should be mentioned in the documentation that this coded is not bijective. -- components: Library (Lib) messages: 207281 nosy: fredstober priority: normal severity: normal status: open title: quopri_codec newline handling versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20121 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19100] Use backslashreplace in pprint
Changes by Fred L. Drake, Jr. fdr...@gmail.com: -- assignee: - fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19100 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
RE: noobie needs help with ctypes
Mucho apologies for rich text, I think I picked that up when replying to a post without properly checking. Thanks for heads up. Fred. -- https://mail.python.org/mailman/listinfo/python-list
noobie needs help with ctypes
I'm using python 2.6 on Linux/CentOs 6.x I'm getting ctypes to work, but getting stuck on the use of .argtypes. Can someone point out what I'm doing. This is my first use of ctypes and it looks like I'm getting different definitions in stackoverflow that may correspond to different version of python. Here is my code. Without the restype/argtypes it works, but I cannot figure out how to define argtypes to match the data. mylibrary = ctypes.CDLL(LIBRARY_PATH) mdsconvert = mylibrary.RugVersionConverter mdsconvert.restype = ctypes.c_int mdsconvert.argtypes = [ charptr, #flat buffer of mds 3.0 data ctypes.c_buffer, #computed flat buffer of mds 2.0 data ctypes.c_buffer #version set to 1.00.4 in c++, never used ] def convertMds2to3(mds30buffer): mds20 = ctypes.create_string_buffer('\000'*3000) t = ctypes.create_string_buffer('\000'*30) success = mdsconvert(mds30buffer, ctypes.byref(mds20), ctypes.byref(t) ) print 'convert %s to %s success=%s version=%s' % (len(mds30buffer), len(mds20.value), success, t.value) return mds20.value --- C++ code looks like this --- extern C int RugVersionConverter( char * sInputRecord, char * MDS2_Rec, char * Version ); where sInputRecord is input and MDS2_Rec and Version are output. -- https://mail.python.org/mailman/listinfo/python-list
RE: noobie needs help with ctypes
My management requires that we stick with the version that comes with CentOs which is 2.6. I know that it’s possible to have multiple versions co-resident with or without virtualenv, but policy is policy ☹ From: Python-list [mailto:python-list-bounces+frsells=adventistcare@python.org] On Behalf Of Joel Goldstick Sent: Monday, December 09, 2013 3:22 PM To: Terry Reedy Cc: python-list@python.org Subject: Re: noobie needs help with ctypes On Mon, Dec 9, 2013 at 3:15 PM, Terry Reedy tjre...@udel.edumailto:tjre...@udel.edu wrote: On 12/9/2013 2:24 PM, Sells, Fred wrote: I'm using python 2.6 on Linux/CentOs 6.x I would use the latest 2.7 (or 3.3) for a new project if at all possible. I seem to recall that Centos needs 2.6 as default python for its own purposes, so you need to install another version without messing with 2.6. VirtualEnv might help. I'm getting ctypes to work, but getting stuck on the use of .argtypes. Can someone point out what I'm doing. This is my first use of ctypes and it looks like I'm getting different definitions in stackoverflow that may correspond to different version of python. In particular, I am sure that there have been bugfixes for ctypes. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
[issue19504] Change customise to customize.
Fred L. Drake, Jr. added the comment: Not a foolish consistency; Guido ruled long ago that American spellings should be used. -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19504 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Fred L. Drake, Jr. added the comment: Advising the reader to be aware of the security warnings in the API documentation seems sufficient. JSON isn't intended to support arbitrary data, and that's what this section is discussing. Another section about data interchange with other applications (regardless of language), may be a reasonable addition, or a good candidate for a separate How-To document that can be referenced. -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Fred L. Drake, Jr. added the comment: When I read ... that can take almost any Python object ..., I don't think the recommendation is about just a few types. The Zope and ZODB communities certainly use pickle extensively, we're aware of the security implications, and we send pickled data over the network all the time. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18840] Tutorial recommends pickle module without any warning of insecurity
Changes by Fred L. Drake, Jr. fdr...@gmail.com: -- nosy: -fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18501] _elementtree.c calls Python callbacks while a Python exception is set
Changes by Fred L. Drake, Jr. fdr...@gmail.com: -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18501 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17987] test.support.captured_stderr, captured_stdin not documented
Fred L. Drake, Jr. added the comment: From v5 of the patch: + A context managers that temporarily replaces the :data:`sys.stdin` / + :data:`sys.stdout` / :data:`sys.stderr` stream with :class:`io.StringIO` + object. I'd go with singular nouns instead of trying to map across them with plurals: Context manager that temporarily replaces the named stream with an :class:`io.StringIO` object. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17987 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17987] test.support.captured_stderr, captured_stdin not documented
Fred L. Drake, Jr. added the comment: Joining the documentation for captured_stderr and captured_stdout makes sense, as they can really use a single example, and the usage is completely parallel. I'd rather see captured_stdin handled separately, perhaps with some additional comments in the example, to emphasize the intended usage pattern: with support.captured_stdin() as s: # Prepare simulated input: s.write('hello\n') s.seek(0) # Call test code that consumes from stdin: captured = input() self.assertEqual(captured, hello) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17987 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17987] test.support.captured_stderr, captured_stdin not documented
Fred L. Drake, Jr. added the comment: +1 for issue17987_4.patch Thanks, Dmi! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17987 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18085] Verifying refcounts.dat
Fred L. Drake, Jr. added the comment: I'm a little surprised that still exists. The first version was generated manually. -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18085 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18085] Verifying refcounts.dat
Fred L. Drake, Jr. added the comment: Were I adding that today, I'd use a more verbose (but more standard) format, like configparser or JSON. If any further use is going to be made of it, that should be considered. Colon-delimited is a pretty fragile format. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18085 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17995] report,中 高 层 管 理 技 能158766
Changes by Fred L. Drake, Jr. fdr...@gmail.com: -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17995 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17987] test.support.captured_stderr, captured_stdin not documented
New submission from Fred L. Drake, Jr.: The captured_stderr and captured_stdin context managers aren't documented, and should be. -- assignee: docs@python components: Documentation keywords: easy messages: 189311 nosy: docs@python, fdrake priority: normal severity: normal stage: needs patch status: open title: test.support.captured_stderr, captured_stdin not documented type: enhancement versions: Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17987 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17950] Dynamic classes contain non-breakable reference cycles
Changes by Fred L. Drake, Jr. fdr...@gmail.com: -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17950 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17868] pprint long non-printable bytes as hexdump
Changes by Fred L. Drake, Jr. fdr...@gmail.com: -- nosy: -fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17868 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17571] broken links on Lib/datetime.py docstring
Fred L. Drake, Jr. added the comment: Let's just update the docstring: Concrete date/time and related types. See also http://dir.yahoo.com/Reference/calendars/ For a primer on DST, including many current DST rules, see http://webexhibits.org/daylightsaving/ Sources for time zone and DST data: http://www.twinsun.com/tz/tz-link.htm This was originally copied from the sandbox of the CPython CVS repository. Thanks to Tim Peters for suggesting using it. -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17571 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
RE: Shebang line on Windows?
When moving from windows to unix you need to run dos2unix on any programs that use shebang (at least with python 2.6) that is installed on some platforms but must be installed on others like CentOs but it is in their repository. -Original Message- From: Python-list [mailto:python-list-bounces+frsells=adventistcare@python.org] On Behalf Of James Harris Sent: Friday, February 22, 2013 5:53 PM To: python-list@python.org Subject: Re: Shebang line on Windows? On Feb 22, 6:40 pm, Zachary Ware zachary.ware+pyl...@gmail.com wrote: On Fri, Feb 22, 2013 at 12:16 PM, Walter Hurry walterhu...@lavabit.com wrote: I use FreeBSD or Linux, but my son is learning Python and is using Windows. My question is this: Would it be good practice for him to put #!/usr/bin/ env python at the top of his scripts, so that if made executable on *nix they will be OK? As I understand it this will have no effect on Windows itself. Adding the shebang line on Windows would be excellent practice. A word of warning unless this has since been resolved: Whenever I have tried adding the shebang line on Windows and running it on Unix the latter has complained about the carriage return at the end of the line. This means that Unix does not work when invoked as follows. (And, yes, the file has had chmod +x applied.) ./program.py It is, of course, OK when run as python program.py but that removes some of the benefit of the shebang line. James -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
[issue2175] Expat sax parser silently ignores the InputSource protocol
Changes by Fred L. Drake, Jr. f...@fdrake.net: -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2175 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17150] pprint could use line continuation for long string literals
Fred L. Drake, Jr. added the comment: I like this. It would be especially nice if it were smart enough to split the segments after sequences of line-ends (r'(\r?\n)+'). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17150 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
derived class name in python 2.6/2.7
This is simple, but I just cannot find it after quite a bit of searching I have this basic design class A: def __init__(self): print 'I am an instance of ', self.__class__.name class B(A): pass X = B I would like this to print I am an instance of B but I keep getting A. Can someone help me out here. -- http://mail.python.org/mailman/listinfo/python-list
RE: New in Python , Need a Mentor
The need for a python-aware editor is the commonly held opinion, although the debate about which editor is endless. I use Eclipse + PyDev only because I found it first and like it. The only suggestion I would offer is to separate the business logic completely from the HTML request/response handler. It makes it much easier to debug. Other than that, ditto to everyone else's response. Fred. -- http://mail.python.org/mailman/listinfo/python-list
[issue16240] Document a way to escape metacharacters in glob/fnmatch
Fred L. Drake, Jr. added the comment: Better (IMO): Wrap the meta-characters in brackets for a literal match. For example, ``'[?]'`` matches the character ``'?'``. -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16240 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Geodetic functions library GeoDLL 32 Bit and 64 Bit
Hi developers, who develops programs with geodetic functionality like world-wide coordinate transformations or distance calculations, can use geodetic functions of my GeoDLL. The Dynamic Link Library can easily be used with most of the modern programming languages like C, C++, C#, Basic, Delphi, Pascal, Java, Fortran, Visual-Objects and others to add geodetic functionality to own applications. For many programming languages appropriate Interfaces are available. GeoDLL supports 2D and 3D coordinate transformation, geodetic datum shift and reference system convertion with Helmert, Molodenski and NTv2 (e.g. BeTA2007, AT_GIS_GRID, CHENYX06), meridian strip changing, user defined coordinate and reference systems, distance calculation, Digital Elevation Model, INSPIRE support, Direct / Inverse Solutions and a lot of other geodetic functions. The DLL is very fast, save and compact because of forceful development in C++ with Microsoft Visual Studio 2010. The geodetic functions of the current version 12.35 are available in 32bit and 64bit architecture. All functions are prepared for multithreading and server operating. You find a free downloadable test version on http://www.killetsoft.de/p_gdlb_e.htm Notes about the NTv2 support can be found here: http://www.killetsoft.de/p_gdln_e.htm Report on the quality of the coordinate transformations: http://www.killetsoft.de/t_1005_e.htm Fred Email: info_at_killetsoft.de -- http://mail.python.org/mailman/listinfo/python-list
RE: Object Models - decoupling data access - good examples ?
Given that the customer is always right: In the past I've dealt with this situation by creating one or more query classes and one or more edit classes. I found it easier to separate these. I would then create basic methods like EditStaff.add_empooyee(**kwargs) inside of which I would drop into (in my case) MySQLdb. In retrospect, I'm not sure that the generick use of **kwargs was a good solution in that it masked what I was passing in, requiring me to go back to the calling code when debugging. OTOH it allowed me to be pretting generic by using Sql = sql_template % kwargs On the query side. I would convert the returned list of dictionaries to a list of objects using something like Class DBrecord: Def __init__(self, **kwargs): Self.__dict__.update(kwargs) So that I did not have to use the record['fieldname'] syntax but could use record.fieldname. I would describe myself as more of a survivalist programmer, lacking some of the sophisticated techniques of others on the mailing list so take that into account. Fred. -Original Message- From: python-list-bounces+frsells=adventistcare@python.org [mailto:python-list-bounces+frsells=adventistcare@python.org] On Behalf Of shearich...@gmail.com Sent: Saturday, August 04, 2012 11:26 PM To: python-list@python.org Subject: Re: Object Models - decoupling data access - good examples ? Just out of curiosity, why do you eschew ORMs? Good question ! I'm not anti-ORM (in fact in many circs I'm quite pro-ORM) but for some time I've been working with a client who doesn't want ORMs used (they do have quite good reasons for this although probably not as good as they think). I was interested to know, given that was the case, how you might - in Python, go about structuring an app which didn't use an ORM but which did use a RDBMS fairly intensively. I take your point about having rolled my own ORM - lol - but I can assure you what's in that 'bardb' is a pretty thin layer over the SQL and nothing like the, pretty amazing, functionality of, for instance, SQLAlchemy. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
RE: Diagramming code
You leave many relevant questions unanswered. 1. Is the original developer/team available or have you been left with the code and little or no doc's? 2. How big is big in terms of the number of files/modules in the project? 3. Is there a reasonable structure to the project in terms of directories and a meaningful hierarchy 4. Does the project currently work and you just have to maintain/enhance it or was it abandoned by the original team in an unknown state and you have to save a sinking ship? 5. Are you an experienced Python programmer or a beginner. 6. Is the original code pythonic (i.e. clean and simple with brief, well organized methods) or do you have functions over 50 lines of code with multiple nested control statements and meaningless variable names? 7. Is there any documentation that defines what it should do and how it should do it. i.e. how do you know when it's working? These issues are not really Python specific, but if you've been given a broken project that has 200 poorly organized modules and little or no documentation and no access to the original team, a good first step would be to update your resume ;) OK then, let me ask, how do you guys learn/understand large projects ? hamilton -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
[issue15120] Different behavior of html.parser.HTMLParser
Changes by Fred L. Drake, Jr. f...@fdrake.net: -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15120 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
RE: Overlayong PDF Files
Assuming your form has actual PDF data entry fields. I export the form to a .fdf file, run a little script to replace fieldnames with %(fieldname)s and save this as a staic template. At run time I'll merge the template with a python dictionary using the % operator and shell down to pdftk to merge the two files and create a filled in PDF. This way you don't have to worry about exact placement of data. I have been looking for an api that would let me do this without the .fdf step, but to no avail. -Original Message- From: python-list-bounces+frsells=adventistcare@python.org [mailto:python-list-bounces+frsells=adventistcare@python.org] On Behalf Of Adam Tauno Williams Sent: Thursday, April 26, 2012 8:25 AM To: python-list@python.org Subject: Re: Overlayong PDF Files On Wed, 2012-04-25 at 13:36 -0500, Greg Lindstrom wrote: I would like to take an existing pdf file which has the image of a health care claim and overlay the image with claim data (insured name, address, procedures, etc.). I'm pretty good with reportlab -- in fact, I've created a form close to the CMS 1500 (with NPI), but it's not close enough for scanning. I'd like to read in the official form and add my data. Is this possible? I 'overlay' PDF documents using pypdf. Example http://coils.hg.sourceforge.net/hgweb/coils/coils/file/9d6c304dd405/src/coils/logic/workflow/actions/doc/watermark.py -- Adam Tauno Williams http://www.whitemiceconsulting.com System Administrator, OpenGroupware Developer, LPI / CNA Fingerprint 8C08 209A FBE3 C41A DD2F A270 2D17 8FA4 D95E D383 -- http://mail.python.org/mailman/listinfo/python-list
[issue14009] Clearer documentation for cElementTree
Fred L. Drake, Jr. f...@fdrake.net added the comment: Developers with existing code can reasonably be expected to look it up based on what they're currently importing, so an entry that points to the new recommended practice is good. -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14009 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
RE: Using the Python Interpreter as a Reference
Steven, that's probably the most elegant explanation of the pythonic way I've ever seen. I'm saving it for the next time upper management want to use Java again. -Original Message- From: python-list-bounces+frsells=adventistcare@python.org [mailto:python-list-bounces+frsells=adventistcare@python.org] On Behalf Of Steven D'Aprano Sent: Thursday, December 01, 2011 7:43 PM To: python-list@python.org Subject: Re: Using the Python Interpreter as a Reference On Thu, 01 Dec 2011 10:03:53 -0800, DevPlayer wrote: [...] Well, that may be a little hyperbolic. But with 2 spaces you can encourage coders to get very deep, indentially, and still fit 80 chars. Why would you want to encourage coders to write deeply indented code? In my opinion, if your code is indented four or more levels, you should start to think about refactorising your code; if you reach six levels, your code is probably a mess. class K: def spam(): if x: for a in b: # This is about as deep as comfortable while y: # Code is starting to smell try: # Code smell is now beginning to reek with z as c: # And now more of a stench try: # A burning, painful stench if d: # Help! I can't breathe!!! for e in f: # WTF are you thinking? try: # DIE YOU M***ER!!! while g: # gibbers quietly ... The beauty of languages like Python where indentation is significant is that you can't hide from the ugliness of this code. class K: { # Code looks okay to a casual glance. def spam():{ if x: { for a in b:{ while y:{ try:{ with z as c:{ try:{ if d:{ for e in f:{ try:{ while g:{ ... Deeply indented code *is* painful, it should *look* painful. -- Steven -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
RE: Py and SQL
I find it easier to code like this Sql = ‘’’select yadda, yadda, yadda FROM a,b,c Where this=that ORDER BY deudderting’’’ With the appropriate %s(varname) and % against a dictionary rather than positional args, but that’s just me. From: python-list-bounces+frsells=adventistcare@python.org [mailto:python-list-bounces+frsells=adventistcare@python.org] On Behalf Of Jerry Hill Sent: Wednesday, November 30, 2011 5:15 PM To: Verde Denim Cc: Python list Subject: Re: Py and SQL On Wed, Nov 30, 2011 at 3:30 PM, Verde Denim tdl...@gmail.com wrote: dbCursor1.execute('select lpad(' ', 2*level) || c Privilege, Roles and Users from ( select null p, name c from system_privilege_map where name like upper(\'%enter_privliege%\') union select granted_role p, grantee c from dba_role_privs union select privilege p, grantee c from dba_sys_privs) start with p is null connect by p = prior c') I think this is your problem. Your string is delimited with single quotes on the outside ('), but you also have a mix of single and double quotes inside your string. If you were to assign this to a variable and print it out, you would probably see the problem right away. You have two options. First, you could flip the outer quotes to double quotes, then switch all of the quotes inside the string to single quotes (I think that will work fine in SQL). Second, you could use a triple-quoted string by switching the outer quotes to ''' or . Doing that would let you mix whatever kinds of quotes you like inside your string, like this (untested): sql = '''select lpad(' ', 2*level) || c Privilege, Roles and Users from ( select null p, name c from system_privilege_map where name like upper(\'%enter_privliege%\') union select granted_role p, grantee c from dba_role_privs union select privilege p, grantee c from dba_sys_privs) start with p is null connect by p = prior c''' dbCursor1.execute(sql) Once you do that, I think you will find that the enter_priviliege bit in your SQL isn't going to do what you want. I assume you're expecting that to automatically pop up some sort of dialog box asking the user to enter a value for that variable? That isn't going to happen in python. That's a function of the database IDE you use. You'll need to use python to ask the user for the privilege level, then substitute it into the sql yourself. -- Jerry -- http://mail.python.org/mailman/listinfo/python-list
[issue11379] Remove lightweight from minidom description
Fred L. Drake, Jr. f...@fdrake.net added the comment: Removing Lightweight and changing the first paragraph to (something like) :mod:`xml.dom.minidom` is an implementation of the Document Object Model interface. The API is slightly simpler than the full W3C DOM, but the implementation has a significantly higher memory footprint than :mod:`xml.dom.etree`. would be entirely reasonable. (I don't think it's wrong to discuss relative memory footprints in comparison to other modules in the standard library.) -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11379 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
RE: Using the Python Interpreter as a Reference
I'm looking at a variation on this theme. I currently use Flex/ActionScript for client side work, but there is pressure to move toward HTML5+Javascript and or iOS. Since I'm an old hand at Python, I was wondering if there is a way to use it to model client side logic, then generate the javascript and ActionScript. I don't see an issue using custom python objects to render either mxml, xaml or html5 but I'm not aware if anyone has already solved the problem of converting Python (byte code?) to these languages? Any suggestions. -- http://mail.python.org/mailman/listinfo/python-list
RE: webapp development in pure python
Quixote may be what you want, but it's been years since I've used it and I don't know if it is still alive and kicking. It was from MEMS if I remember correctly. Using django and Flex is one way to avoid html and javascript and it works great for datagrids. Fred. -- http://mail.python.org/mailman/listinfo/python-list
[issue670664] HTMLParser.py - more robust SCRIPT tag parsing
Changes by Fred L. Drake, Jr. f...@fdrake.net: -- nosy: -fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue670664 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Advice on how to get started with 2D-plotting ?
Wow, what an impressive turnout ! Thanks a lot, rantingrick, CM and Herbert, for the fast answers, useful tips and especially the sample code ! Beats starting from a blank page, with a big stick, and will certainly set me on my way much faster... networkx does seem a bit over the top for my simple goal, but both the Tk (I always forget Tk !) and Matplotlib approaches seem to fit the KISS principle just fine... on to the tinkering now :-) Again, thanks to all ! fp -- http://mail.python.org/mailman/listinfo/python-list
Advice on how to get started with 2D-plotting ?
Hi, I'm a Python long-timer, but I've never had to use tools like Matplotlib others before. Now, for my work, I would need to learn the basics fast, for a one-time quick-n-dirty job. This involves a graphic comparison of RFC1918 IP subnets allocation across several networks. The idea is to draw parallel lines, with segments (subnets) coloured green, yellow or red depending on the conflicts between the networks. What would be the simplest/fastest way of getting this done ? (the graphic parts, the IP stuff I know how to handle) Alternately, if someone knows of a ready-made and accessible tool that does just that, I'm all ears :-) TIA, fp -- http://mail.python.org/mailman/listinfo/python-list
[issue10149] Data truncation in expat parser
Fred L. Drake, Jr. f...@fdrake.net added the comment: Chunking of the data is expected with Expat. There are no promises about *where* chunks are broken; the underlying behavior will break at line endings, but is not limited to that. Setting buffer_text informs the Python wrapper that it's allowed to combine the chunks reported by the Expat library; this was made optional since it could affect working applications (changing the default with the move to Python 3 may have been acceptable, though). -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10149 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
RE: Community Involvement
After the completion of most training courses, the students are not yet ready to make a meaningful contribution to the community. Yet your goal of getting them involved in the community is worthwhile. I would think learning to use the community as a resource to solve a problem that is not based on the standard modules would be a good one. I liked the recipe suggestion as well, but I think you would need to post a list of items to choose and remove the item when the recipe has been posted. Otherwise you could get a gazillion examples of sorting a dictionary... Just my 2 cents FWIW Fred Sells -- http://mail.python.org/mailman/listinfo/python-list
reading zipfile; problem using raw buffer
I'm tring to unzip a buffer that is uploaded to django/python. I can unzip the file in batch mode just fine, but when I get the buffer I get a BadZipfile exception. I wrote this snippet to try to isolate the issue but I don't understand what's going on. I'm guessing that I'm losing some header/trailer somewhere? def unittestZipfile(filename): buffer = '' f = open(filename) for i in range(22): block = f.read() if len(block) == 0: break else: buffer += block print len(buffer) tmp = open('tmp.zip', 'w') tmp.write(buffer) tmp.close() zf = zipfile.ZipFile('tmp.zip') print dir(zf) for name in zf.namelist(): print name print zf.read(name) 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] Traceback (most recent call last): File C:\all\projects\AccMDS30Server\mds30\app\uploaders\xmitzipfile.py, line 162, in module unittestZipfile('wk1live7.8to7.11.zip') File C:\all\projects\AccMDS30Server\mds30\app\uploaders\xmitzipfile.py, line 146, in unittestZipfile print zf.read(name) File C:\alltools\python26\lib\zipfile.py, line 837, in read return self.open(name, r, pwd).read() File C:\alltools\python26\lib\zipfile.py, line 867, in open raise BadZipfile, Bad magic number for file header zipfile.BadZipfile: Bad magic number for file header -- http://mail.python.org/mailman/listinfo/python-list
RE: reading zipfile; problem using raw buffer
Thanks all, adding the 'rb' and 'wb' solved that test case. The reason I read the file the hard way is that I'm testing why I cannot unzip a buffer passed in a file upload using django. While not actually using a file, pointing out the need for the binary option gave me the clue I needed to upload the file All is good and moving on to the next crisis ;) Fred. -- http://mail.python.org/mailman/listinfo/python-list
RE: Selecting unique values
The set module or function (depends on which python version) will do this if you make each record a tuple. -Original Message- From: python-list-bounces+frsells=adventistcare@python.org [mailto:python-list-bounces+frsells=adventistcare@python.org] On Behalf Of Peter Otten Sent: Tuesday, July 26, 2011 5:04 AM To: python-list@python.org Subject: Re: Selecting unique values Kumar Mainali wrote: I have a dataset with occurrence records of multiple species. I need to get rid of multiple listings of the same occurrence point for a species (as you see below in red and blue typeface). How do I create a dataset only with unique set of longitude and latitude for each species? Thanks in advance. Species_name Longitude Latitude Abies concolor -106.601 35.868 Abies concolor -106.493 35.9682 Abies concolor -106.489 35.892 Abies concolor -106.496 35.8542 Accipiter cooperi -119.688 34.4339 Accipiter cooperi -119.792 34.5069 Accipiter cooperi -118.797 34.2581 Accipiter cooperi -77.38333 39.68333 Accipiter cooperi -77.38333 39.68333 Accipiter cooperi -75.99153 40.65 Accipiter cooperi -75.99153 40.65 def uniquify(items): ... seen = set() ... for item in items: ... if item not in seen: ... seen.add(item) ... yield item ... import sys sys.stdout.writelines(uniquify(open(species.txt))) Species_name Longitude Latitude Abies concolor -106.601 35.868 Abies concolor -106.493 35.9682 Abies concolor -106.489 35.892 Abies concolor -106.496 35.8542 Accipiter cooperi -119.688 34.4339 Accipiter cooperi -119.792 34.5069 Accipiter cooperi -118.797 34.2581 Accipiter cooperi -77.38333 39.68333 Accipiter cooperi -75.99153 40.65 If you need to massage the lines a bit: def uniquify(items, key=None): ... seen = set() ... for item in items: ... if key is None: ... keyval = item ... else: ... keyval = key(item) ... if keyval not in seen: ... seen.add(keyval) ... yield item ... Unique latitudes: sys.stdout.writelines(uniquify(open(species.txt), key=lambda s: s.rsplit(None, 1)[-1])) Species_name Longitude Latitude Abies concolor -106.601 35.868 Abies concolor -106.493 35.9682 Abies concolor -106.489 35.892 Abies concolor -106.496 35.8542 Accipiter cooperi -119.688 34.4339 Accipiter cooperi -119.792 34.5069 Accipiter cooperi -118.797 34.2581 Accipiter cooperi -77.38333 39.68333 Accipiter cooperi -75.99153 40.65 Unique species names: sys.stdout.writelines(uniquify(open(species.txt), key=lambda s: s.rsplit(None, 2)[0])) Species_name Longitude Latitude Abies concolor -106.601 35.868 Accipiter cooperi -119.688 34.4339 Bonus: open() is not the built-in here: from StringIO import StringIO def open(filename): ... return StringIO(Species_name Longitude Latitude ... Abies concolor -106.601 35.868 ... Abies concolor -106.493 35.9682 ... Abies concolor -106.489 35.892 ... Abies concolor -106.496 35.8542 ... Accipiter cooperi -119.688 34.4339 ... Accipiter cooperi -119.792 34.5069 ... Accipiter cooperi -118.797 34.2581 ... Accipiter cooperi -77.38333 39.68333 ... Accipiter cooperi -77.38333 39.68333 ... Accipiter cooperi -75.99153 40.65 ... Accipiter cooperi -75.99153 40.65 ... ) ... -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
RE: Refactor/Rewrite Perl code in Python
Sometimes it's worth asking Why? I assume there would be no need to rewrite if the existing code did most of what was needed. It may be easier to ask the customer what he really wants rather than to re-engineer a crappy solution to an obsolete problem. -- http://mail.python.org/mailman/listinfo/python-list
Geodetic functions library GeoDLL 32 Bit and 64 Bit
Hi developers, who develops programs with geodetic functionality like world-wide coordinate transformations or distance calculations, can work with the latest version of my GeoDLL. The Dynamic Link Library can easily be used with any programming language to add geodetic functionality to own applications. GeoDLL supports 2D and 3D coordinate transformation, geodetic datum shift and reference system convertion, meridian strip changing, user defined coordinate and reference systems, distance calculation, Digital Elevation Model, NTv2 handling, Direct / Inverse Solutions and a lot of other geodetic functions. The DLL has become very fast and save by forceful development in C++ with Microsoft Visual Studio 2010. The geodetic functions of the new version 12.05 now are available in 32bit and 64bit architecture. You find a downloadable test version on http://www.killetsoft.de/p_gdla_e.htm. -- http://mail.python.org/mailman/listinfo/python-list
[issue12409] Moving Documenting Python to Devguide
Fred L. Drake, Jr. fdr...@acm.org added the comment: -1 Hi! We have the devguide now, and it should be the place where to look for references and docs about contributing to Python, that means also for the documentation. For information specific to the Python documentation itself, but not relevant to users documenting their own projects, yes. In the official Python doc we have a section Documenting Python (http://docs.python.org/py3k/documenting/index.html) and I think it should be merged into the devguide - what's your opinion on that? The scope of this document is much larger than Python's documentation, but extends to all projects written in Python that use Sphinx as their documentation tool. With that, it makes sense to keep it as part of the documentation for users of Python. -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12409 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12394] packaging: generate scripts from callable (dotted paths)
Fred L. Drake, Jr. fdr...@acm.org added the comment: People working on this should probably also look at how zc.buildout's zc.recipe.egg handles script generation. It's similar to setuptools in that console_script entry points are used, but it binds in the desired Python executable as well. (If you ran the build with an unversioned Python executable name, that's what you get, but if you use a versioned path, it's retained.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12226] use secured channel for uploading packages to pypi
Fred L. Drake, Jr. fdr...@acm.org added the comment: On Mon, Jun 6, 2011 at 11:50 AM, Éric Araujo rep...@bugs.python.org wrote: If you make an HTTPS connection without checking the certificate, what security does it add? I'm in favor of cert checking, myself. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12226 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12226] use secured channel for uploading packages to pypi
Fred L. Drake, Jr. fdr...@acm.org added the comment: On Wed, Jun 1, 2011 at 11:14 AM, anatoly techtonik techto...@gmail.com wrote: Adding catalog-sig to CC. I can guarantee this for Windows. I'll be near Linux box tomorrow and will try upload to PyPI from there. It still will be more authoritative if more than one person can test upload to PyPI with this patch on different systems. The interesting case will be for a build that doesn't include SSL support. -Fred -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12226 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12043] Update shutil documentation
Changes by Fred L. Drake, Jr. fdr...@acm.org: -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12043 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
newbie needs help with cookielib
I'm using Python 2.4 and 2.7 for different apps. I'm happy with a solution for either one. I've got to talk to a url that uses a session cookie. I only need to set this when I'm developing/debugging so I don't need a robust production solution and I'm somewhat confused by the docs on cookielib. I can use urllib2 without cookielib just fine, but need the cookie to add some security. I'm normally using Firefox 4.0 to login to the server and get the cookie. After that I need some way to set the same cookie in my python script. I can do this by editing my code, since I only need it while defeloping from my test W7 box. I was hoping to find something like ...set_cookie('mycookiename', 'myvalue', 'mydomain.org') I've googled this most of the morning and found everything but what I need, or I just don't understand the basic concept. Any pointers would be greatly appreciated. One of my false starts looks like this. But I get a ... File C:\alltools\python26\lib\urllib2.py, line 518, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 500: Access Deinied def test1(): cj = cookielib.MozillaCookieJar() cj.load('C:/Users/myname/Desktop/cookies.txt') opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) r = opener.open(http://daffyduck.mydomain.org/wsgi/myapp.wsgi;) print r.read() return -- http://mail.python.org/mailman/listinfo/python-list
[issue2292] Missing *-unpacking generalizations
Changes by Fred L. Drake, Jr. fdr...@acm.org: -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2292 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9101] reference json format in file formats chapter
Fred L. Drake, Jr. fdr...@acm.org added the comment: And what are these people looking for? json? If so, there's already an entry in the module index. That seems sufficient. -- nosy: +fdrake ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9101 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: What do you use with Python for GUI programming and why?
Robert sigz...@gmail.com said : Is there a push to one toolkit or the other? If you are just now getting started, I would honestly suggest you save a whole lot of time and dive straight into PyQt. I've tried most 'em over the years (including some now discontinued), and in my experience Qt is way above the rest, especially as far as consistency and productivity are concerned. The Python bindings are very mature and well maintained, and go a long way attenuating the evil C++ roots. I havent tried Nokia's equivalent (PySide). I'm not sure what its fate will turn out, given the company's change of heart and Microsoft honeymoon. At least PyQt is't going anywhere soon. YMMV, of course :) -- http://mail.python.org/mailman/listinfo/python-list
[issue11372] Remove xrange from argparse docs
Fred L. Drake, Jr. fdr...@acm.org added the comment: Committed for Python 3.3.0: r88717 Committed for Python 3.2.1: r88718 -- assignee: docs@python - fdrake nosy: +fdrake resolution: - accepted stage: - committed/rejected status: open - closed versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11372 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
OT: Code Examples
I'm interested in developing Python-based programs, including an engineering app. ... re-writing from Fortran and C versions. One of the objectives would to be make reasonable use of the available structure (objects, etc.). So, I'd like to read a couple of good, simple scientific-oriented programs that do that kind of thing. Looking for links, etc. Fred -- http://mail.python.org/mailman/listinfo/python-list
Re: OT: Code Examples
On 2/28/2011 8:14 AM, n00m wrote: On Feb 28, 6:03 pm, Fred Marshallfmarshallxremove_th...@acm.org wrote: The best place for you to start: http://numpy.scipy.org/ Numpy manual: http://www.tramy.us/numpybook.pdf OK Thanks! Fred -- http://mail.python.org/mailman/listinfo/python-list
wxPython in the context of Eclipse
I asked earlier: How do I use wxPython or wxGlade in the context of Eclipse? A link to a howto would be great! I guess nobody knows or cares to answer? :-( -- http://mail.python.org/mailman/listinfo/python-list
wxPython in Eclipse?
How do I use wxPython or wxGlade in the context of Eclipse? A link to a howto would be great! Thanks, Fred -- http://mail.python.org/mailman/listinfo/python-list
Python Newbie needs some context
I can already program in a few languages (but not C++) and, since Python comes to highly recommended, I figured to venture into it. I'm used to using an IDE. So, after some web browsing and reading, I did the following: Installed Python Installed EasyEclipse Installed wxPython Installed wxGlade My objective is to develop some relatively simple GUI applications. Since I'm still on a steep learning curve with all these things I'm clearly missing some of the structural context and wonder where would be really good places to read about: 1) Is it the intent to generate code with wxGlade and then rather import that code into an Eclipse project context? Or, should one expect to be able to create hooks (e.g. for Tools) in Eclipse that will do that? If so, how? 2) I'm finding the Eclipse terminology re: projects, folders, etc. etc. rather obscure. Where can I learn about good practice and these things. I know what cvs is but won't likely be using it. That is, which item in the hierarchy is best used for what? Thanks, Fred -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Newbie needs some context
On 2/16/2011 11:45 AM, Grant Edwards wrote: Thanks for the advice! Is it the intent to generate code with wxGlade and then rather import that code into an Eclipse project context? Or, should one expect to be able to create hooks (e.g. for Tools) in Eclipse that will do that? If so, how? Thanks, Fred -- http://mail.python.org/mailman/listinfo/python-list