[issue9951] introduce bytes.hex method

2014-09-11 Thread Chris Lasher
Chris Lasher added the comment: int has int.from_bytes and int.to_bytes. Currently, bytes has bytes.fromhex. Would the core developers please consider naming the method bytes.tohex instead of bytes.hex, so there's at least a modicum of consistency in the method names of Python's builtin types

[issue9951] introduce bytes.hex method

2014-09-10 Thread Chris Lasher
Changes by Chris Lasher chris.las...@gmail.com: -- nosy: +gotgenes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9951 ___ ___ Python-bugs-list

[issue10984] argparse add_mutually_exclusive_group should accept existing arguments to register conflicts

2011-01-22 Thread Chris Lasher
New submission from Chris Lasher chris.las...@gmail.com: argparse supports registering conflicting arguments, however, it does so in a way that an argument may belong to at most one group of conflicting arguments. The inspiration for this bug is Stack Overflow question #4770576. http

[issue10745] --user option, per user site-packages undocumented in Installing Python Modules document

2010-12-20 Thread Chris Lasher
New submission from Chris Lasher chris.las...@gmail.com: Python 2.6 saw the introduction of per user site-packages directory for easy installation of Python packages into a guaranteed location in which the user has appropriate permissions. http://bugs.python.org/issue1799 http

[issue7744] Allow site.addsitedir insert to beginning of sys.path

2010-01-20 Thread Chris Lasher
New submission from Chris Lasher chris.las...@gmail.com: Would it be possible to add an extra option to site.addsitedir so that it left-appends (inserts at the beginning of the list rather than the end of the list) to sys.path the new path? The use case for this is that sometimes the user has

[issue7744] Allow site.addsitedir insert to beginning of sys.path

2010-01-20 Thread Chris Lasher
Chris Lasher chris.las...@gmail.com added the comment: One correction: by beginning of sys.path, what I really mean is, the portion of sys.path after the initial ''. I forgot that '', the empty path, should always be at the start of sys.path to ensure that packages and modules in the current

[issue7445] urllib2 (and urllib) should raise error for incomplete response

2009-12-05 Thread Chris Lasher
New submission from Chris Lasher chris.las...@gmail.com: This question is motivated by a question on Stack Overflow: http://stackoverflow.com/questions/1824069/urllib2-not-retrieving-entire-http-response In the event the user receives an incomplete response when using urllib2 (and urllib

[issue3244] multipart/form-data encoding

2009-01-07 Thread Chris Lasher
Changes by Chris Lasher chris.las...@gmail.com: -- nosy: +gotgenes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3244 ___ ___ Python-bugs-list

Re: Priority Queue with Mutable Elements

2007-06-16 Thread Chris Lasher
On Jun 15, 5:52 pm, Josiah Carlson [EMAIL PROTECTED] wrote: See this implementation of a pair heap: http://mail.python.org/pipermail/python-dev/2006-November/069845.html ...which offers the ability to update the 'priority' of an entry in the heap. It requires that the 'value' in (priority,

Priority Queue with Mutable Elements

2007-06-15 Thread Chris Lasher
Hello, I am working with large graphs (~150,000 to 500,000 nodes) which I need decompose node-by-node, in order of a node's value. A node's value is determined by the sum of its edge weights. When a node is removed from the graph, its neighbors' values must be updated to take into account the

Shebang or Hashbang for modules or not?

2007-04-11 Thread Chris Lasher
Should a Python module not intended to be executed have shebang/ hashbang (e.g., #!/usr/bin/env python) or not? I'm used to having a shebang in every .py file but I recently heard someone argue that shebangs were only appropriate for Python code intended to be executable (i.e., run from the

Re: Why NOT only one class per file?

2007-04-08 Thread Chris Lasher
On Apr 4, 5:23 pm, Chris Lasher [EMAIL PROTECTED] wrote: A friend of mine with a programming background in Java and Perl places each class in its own separate file in . I informed him that keeping all related classes together in a single file is more in the Python idiom than one file per class

Why NOT only one class per file?

2007-04-04 Thread Chris Lasher
A friend of mine with a programming background in Java and Perl places each class in its own separate file in . I informed him that keeping all related classes together in a single file is more in the Python idiom than one file per class. He asked why, and frankly, his valid question has me

Re: PDB does not allow jumping to first statement?

2007-03-28 Thread Chris Lasher
I have submitted this as a bug via SourceForge: https://sourceforge.net/tracker/? func=detailatid=105470aid=1689458group_id=5470 or if munged http://tinyurl.com/2nwxsf The Python folks would like a test case and/or a patch. This is well beyond my ken as a humble Python user. Could anybody more

Re: PDB does not allow jumping to first statement?

2007-03-27 Thread Chris Lasher
On Mar 27, 5:59 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I tried on GNU/Linux and Python versions 2.4 and 2.5 and get the same behavior. Best as I can tell, it looks like a bug in Python. pdb, pydb, rpdb2 all handle the jump command by changing the frame f_lineno value. When the

Re: Python automatic testing: mocking an imported module?

2007-03-27 Thread Chris Lasher
On Mar 27, 6:18 pm, Silfheed [EMAIL PROTECTED] wrote: Heyas So we have the following situation: we have a testee.py that we want to automatically test out and verifiy that it is worthy of being deployed. We want our tester.py to test the code for testee.py without changing the code for

PDB does not allow jumping to first statement?

2007-03-26 Thread Chris Lasher
Hi all, I have a simple script: --- #!/usr/bin/env python a = 1 b = 2 c = a + b print c --- I launch said script with pdb: python -m pdb simple.py I noticed that I absolutely cannot jump back to the first statement (line 3, a = 1) using the jump command. I can jump to any other line BUT

Re: build python on Celeron D

2007-03-26 Thread Chris Lasher
On Mar 26, 10:48 pm, Christian [EMAIL PROTECTED] wrote: Traceback (most recent call last): File setup.py, line 89, in ? setup_package() File setup.py, line 59, in setup_package from numpy.distutils.core import setup File /mnt/home/ck/prog/scipy/numpy-1.0.1/numpy/__init__.py,

How to list current line in pdb?

2007-03-23 Thread Chris Lasher
Hi all, Using the pdb shell, after repeatedly entering 'l' (lowercase 'L'), how do I jump back to listing the current line again if I don't remember exactly what line my current line is? Do I just have to list an early line in the code and repeatedly list from there until I see the '-' indicating

Re: How to list current line in pdb?

2007-03-23 Thread Chris Lasher
On Mar 23, 11:56 am, Duncan Booth [EMAIL PROTECTED] wrote: Chris Lasher [EMAIL PROTECTED] wrote: Using the pdb shell, after repeatedly entering 'l' (lowercase 'L'), how do I jump back to listing the current line again if I don't remember exactly what line my current line is? Do I just have

Re: Interacting with keyboard LEDs

2006-12-09 Thread Chris Lasher
Jonathan Curran wrote: Spur of the moment answer: call setleds program from within your program better answer (fox X11): http://python-xlib.sourceforge.net/doc/html/python-xlib_16.html Take a look at get_keyboard_control() and change_keyboard_control(). As far as knowing how to properly

Interacting with keyboard LEDs

2006-12-08 Thread Chris Lasher
Is there a way to interact with keyboard LEDs (for Caps/Scroll/Num Lock) in Python? I'd like to achieve an effect similar to the *NIX command setleds -L, but I'm not sure where to start, but I figured someone out there would have an idea or maybe experience with something similar. Thanks very much

Regular expression for not-group

2006-06-15 Thread Chris Lasher
Is it possible to write a regular expression such that a match is found provided the string does not match a group in the regex? Let me give a concrete example. Suppose I want to find a match to any filename that does not end in .py, (ignoring the obvious use of the .endswith('.py') string

Re: Regular expression for not-group

2006-06-15 Thread Chris Lasher
Man, that's a headslap-worthy overlooking of the obvious. Ha! =-) I was using the redemo.py that comes standard with Python but that Kodos app looks even neater! Thanks for the tip. Thanks Paddy. Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression intricacies: why do REs skip some matches?

2006-04-12 Thread Chris Lasher
Diez, John, Tim, and Ben, thank you all so much. I now get it. It makes logical sense now that the difficulty was actually in the implementation of findall, which does non-overlapping matches. It also makes sense, now, that one can get around this by using a lookahead assertion. Thanks a bunch,

Regular expression intricacies: why do REs skip some matches?

2006-04-11 Thread Chris Lasher
Hey guys and gals, This is a followup of my Counting all permutations of a substring thread (see http://groups.google.com/group/comp.lang.python/browse_thread/thread/60ebeb7ae381b0a9/7657235b3fd3966f#7657235b3fd3966f in Google Groups) I'm still having a difficult time figuring out the intricacies

Re: Counting all permutations of a substring

2006-04-06 Thread Chris Lasher
Great suggestions, guys! Thanks so much! And yes, I stand corrected. A better suited subject title would have been Counting all overlapping substrings. Thanks again, Chris -- http://mail.python.org/mailman/listinfo/python-list

Counting all permutations of a substring

2006-04-05 Thread Chris Lasher
Hi all, How can one count all the permutations of a substring in a string? For a more concrete example, let's say targetstr = 'AAA' and probestr = 'AA' I want to consider how many times one can count probestr ('AA') in targetstr ('AAA'). The value in this example is, obviously, 2: you can match

Re: years later DeprecationWarning

2006-03-22 Thread Chris Lasher
Two things: 1) math.floor returns a float, not an int. Doing an int() conversion on a float already floors the value, anyways. Try replacing math.floor(...) with int(...) e.g. math.floor(5.9) 5.0 int(5.9) 5 2) What kind of data is in f2m? If f2m is a float, you will get float values in the

Re: - Python Newcomer Starting with Coding

2006-03-21 Thread Chris Lasher
And there's always Mark Pilgrim's very good and very free Dive Into Python. http://www.diveintopython.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Zope/Plone - Is it the right solution?

2006-02-21 Thread Chris Lasher
You may want to look at either of the popular frameworks, TurboGears http://www.turbogears.org/ or Django http://www.djangoproject.com/ I have very little experience with both, but I decided to try learning the Django framework after watching the Snakes and Rubies videos. (See

Re: Mining strings from a HTML document.

2006-01-25 Thread Chris Lasher
I think Jay's advice is solid: you shouldn't rule out HTML parsing. It's not too scary and it's probably not overboard. Using a common HTML parsing library saves you from having to write and debug your own parser. Try looking at Dive Into Python's chapter on it, first.

Re: Duplicate entries in a matrix

2006-01-19 Thread Chris Lasher
Hey Gerard, Thanks for the suggestion! It took me a while to figure out how to get this to work. Two things were important: I needed to use the matrixmultiply() function, and the order of the two matrices being multiplied is critcial. Here's how I got the example to work. from Numeric import *

Re: Duplicate entries in a matrix

2006-01-19 Thread Chris Lasher
Now that's definitely what I'm looking for! Thanks! By the way, was this line In [5]: C = repeat(B, [1,2,1], axis=-1) supposed to have a positive 1 value for axis? It works either way, I see. Is it like a lookup, where an index of -1 returns the last value? If that were true, I supposed the

Duplicate entries in a matrix

2006-01-18 Thread Chris Lasher
Hello Pythonistas! I'm looking for a way to duplicate entries in a symmetrical matrix that's composed of genetic distances. For example, suppose I have a matrix like the following: ABC A 0.00 0.50 1.00 B 0.50 0.00 0.50 C 1.00 0.50 0.00 Say

Re: Newbie with some doubts.

2006-01-05 Thread Chris Lasher
Learning Python by Ascher and Lutz has a very good introduction to objects and object-oriented programming. If you're new to programming, I definitely recommend the text. Also, check out Mark Pilgrim's chapter on OOP in Dive Into Python at

Re: Vim IS a capable IDE [was Re: Vim capable IDE?]

2005-10-19 Thread Chris Lasher
Thanks for the replies, guys! I had no idea Vim was capable of doing some of those things. The source browser in Vim is slick--I never would have known about that. As far as the GDB goes, it doesn't look like it has support for Python, but it's nice to know it's there for C if I get the chance to

Re: Vim capable IDE?

2005-10-18 Thread Chris Lasher
Thanks for your responses, guys. I can't get the PIDA page to come up for me; server timeout error. I'll have to look into Eclipse more, but I've been warned that it's resource greedy and that the VI plugin doesn't provide very much functionality. Still, that's hearsay, so I'll have to find out

Re: Vim capable IDE?

2005-10-18 Thread Chris Lasher
Thanks again for your responses, guys. To answer the question,the features I'd love to see in a Python IDE are: * First and foremost, Vim editing behavior. Let me keep my fingers on the homerow. I'm lazy. Point and click and CTRL + SHIFT has its moments, but text editing is not one of them. *

Vim capable IDE?

2005-10-17 Thread Chris Lasher
Hello, Is there a Python-sensitive, Linux compatible IDE out there with standard bells and whistles (source browser, symbolic debugger, etc.) but with the action-per-keystroke editing capabilities of Vim? I have failed to turn up such an IDE in my Googling and IDE project-page browsing. :-(

Re: Unfortunate newbie questions!

2005-09-13 Thread Chris Lasher
I would have to say that never having done any OO programming before in my life, I found _Learning_Python_ by Lutz Ascher had a great couple of chapters on it. The diagrams about inheritance and subclassing really helped a lot and they describe the purpose of using OOP quite well. I see you

Conversion to string: how do `s work?

2005-03-14 Thread Chris Lasher
I'm working my way through _Learning_Python_ 2nd ed., and I saw something peculiar which is not explained anywhere in the text. print + file + size= + `size` The `s appear to somehow automagically convert the integer to a string for concatenation. How does this work? Is this just a shortcut

Re: Conversion to string: how do `s work?

2005-03-14 Thread Chris Lasher
Ah, repr. Did not cross my mind. Good to see my suspicions about the use of ` being poor practice were correct. Explicit is better than implicit. Thanks for the reply. -- http://mail.python.org/mailman/listinfo/python-list

Re: What strategy for random accession of records in massive FASTA file?

2005-01-13 Thread Chris Lasher
Before you get too carried away, how often do you want to do this and how grunty is the box you will be running on? Oops, I should have specified this. The script will only need to be run once every three or four months, when the sequences are updated. I'll be running it on boxes that are

What strategy for random accession of records in massive FASTA file?

2005-01-12 Thread Chris Lasher
Hello, I have a rather large (100+ MB) FASTA file from which I need to access records in a random order. The FASTA format is a standard format for storing molecular biological sequences. Each record contains a header line for describing the sequence that begins with a '' (right-angle bracket)

Troubleshooting: re.finditer() creates object even when no match found

2004-12-17 Thread Chris Lasher
Hello, I really like the finditer() method of the re module. I'm having difficulty at the moment, however, because finditer() still creates a callable-iterator oject, even when no match is found. This is undesirable in cases where I would like to circumvent execution of code meant to parse out

Possible to insert variables into regular expressions?

2004-12-09 Thread Chris Lasher
Hello, I would like to create a set of very similar regular expression. In my initial thought, I'd hoped to create a regular expression with a variable inside of it that I could simply pass a string into by defining this variable elsewhere in my module/function/class where I compile the regular

Re: Possible to insert variables into regular expressions?

2004-12-09 Thread Chris Lasher
Thanks for the reply, Steve! That ought to work quite nicely! For some reason, I hadn't thought of using %-formatting. I probably should have, but I'm still learning Python and re-learning programming in general. This helps a lot, so thanks again. Chris --