Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
wow, tx y'all! I forgot to mention that hashlib itself is not required; I could also use Brand X. But y'all agree that blocking up the file in python adds no overhead to hashing each block in C, so hashlib in a loop it is! -- http://mail.python.org/mailman/listinfo/python-list

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
Tx, all!. But... > For example I use this function to copy a stream and return a SHA512 and > the output streams size: > >     def write(self, in_handle, out_handle): >         m = hashlib.sha512() >         data = in_handle.read(4096) >         while True: >             if not data: >            

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
> - Open the file in binary mode. I had tried open(path, 'rb') and it didn't change the "wrong" number. And I added --binary to my evil md5sum version, and it didn't change the "right" number! Gods bless those legacy hacks that will never die, huh? But I'm using Ubuntu (inside VMWare, on Win7, o

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
> >> def file_to_hash(path, m=None): > >> if m is None: > >> m = hashlib.md5() > The first call will give you the correct checksum, the second: not. As the > default md5 instance remembers the state from the previous function call > you'll get the checksum of both files combined. Ouch. That was i

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
On Jul 6, 11:42 am, Andrew Berg wrote: > On 2011.07.06 12:38 PM, Phlip wrote:> Python sucks. m = md5() looks like an > initial assignment, not a > > special magic storage mode. Principle of least surprise fail, and > > principle of most helpful default behavior fail. >

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
On Jul 6, 1:25 pm, Carl Banks wrote: > We already know about this violation of the least surprise principle; most of > us acknowledge it as small blip in an otherwise straightforward and clean > language. Here's the production code we're going with - thanks again all: def file_to_hash(path,

Re: Does hashlib support a file mode?

2011-07-07 Thread Phlip
> On 2011.07.06 06:16 PM, Steven D'Aprano wrote:> Phlip wrote: > > > > Note the fix also avoids comparing to None, which, as usual, is also > > > icky and less typesafe! > > > "Typesafe"? Are you trying to make a joke? No, I was pointing out

Re: Does hashlib support a file mode?

2011-07-07 Thread Phlip
On Jul 7, 6:24 am, Andrew Berg wrote: > On 2011.07.07 08:11 AM, Phlip wrote:> No, I was pointing out that passing a > type is more ... typesafe. > > None is a type. I never said it wasn't. -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming tips :-)

2011-07-07 Thread Phlip
On Jul 7, 11:36 am, Andrew Berg wrote: > On 2011.07.07 12:22 PM, Martin Schöön wrote:> I just found the following url > in my archives at work and > > thought you might enjoy it: > >http://thc.org/root/phun/unmaintain.html > > That's awesome. That's "How To Write Unmaintainable Code" - a venera

Re: Does hashlib support a file mode?

2011-07-07 Thread Phlip
> I worded that poorly. None is (AFAIK) the only instance of NoneType, but > I should've clarified the difference.> The is operator does not compare > types, it compares instances for identity. None is typesafe, because it's strongly typed. However, what's even MORE X-safe (for various values of

Re: Does hashlib support a file mode?

2011-07-08 Thread Phlip
On Jul 8, 12:42 am, Steven D'Aprano wrote: > Phlip wrote: > >> I worded that poorly. None is (AFAIK) the only instance of NoneType, but > >> I should've clarified the difference.> The is operator does not compare > >> types, it compares instances for ide

Re: CI and BDD with Python

2011-07-09 Thread Phlip
On Jul 8, 9:36 pm, Stefan Behnel wrote: > mark curphey, 09.07.2011 01:41: > > > And for CI having been using Hudson for a while, any real advantages in a > > Python / Django world for adopting something native like Trac and one of > > the CI plugins like Bitten? I'm kind'a partial to Morelia fo

Re: CI and BDD with Python

2011-07-09 Thread Phlip
On Jul 9, 7:39 pm, mark curphey wrote: > Thanks. FWIW I played with a bunch (Freshen, Morelia, Lettuce) Morelia is "undermaintained" because it's finished. It attaches to any pre-existing TestCase-style test runner, hence there's nothing to maintain! Packages like Lettuce rebuild the entire

Re: Morelia for BDD in Python (was: CI and BDD with Python)

2011-07-09 Thread Phlip
On Jul 9, 8:38 pm, Ben Finney wrote: > Phlip writes: > > On Jul 9, 7:39 pm, mark curphey wrote: > > > > Thanks. FWIW I played with a bunch (Freshen, Morelia, Lettuce) > > > Morelia is "undermaintained" because it's finished. It attaches to an

Re: Morelia for BDD in Python (was: CI and BDD with Python)

2011-07-09 Thread Phlip
> -- >  \        “That's the essence of science: Ask an impertinent question, | >   `\            and you're on the way to the pertinent answer.” —Jacob | > _o__)                            Boronowski, _The Ascent of Man_, 1976 | > Ben Finney That nose keeps reminding me of the start of one of the

Re: Morelia for BDD in Python

2011-07-10 Thread Phlip
> I think it would add great value, since without it I'm unlikely to > bother using Morelia in any project. The maintenance burden is too high > to keep adding dependencies that come from a distinct dependency system > outside my OS. pip freeze! Specifically, we already added pip freeze and virtua

Re: Morelia for BDD in Python

2011-07-10 Thread Phlip
Two of my feature requests for Morelia: - integrate with the test runner (nose etc.) to provide one dot . per passing step - insert a long multi-line abstract string (typically XML) with inside [[CDATA-style escaping tags - the ability to stub a step as - the ability to pass a | de

Re: "Python Wizard," with apologies to The Who

2011-07-12 Thread Phlip
> That modeling and sim guy > Sure codes some mean Python! C-; And he changes key on the fly, too! -- http://mail.python.org/mailman/listinfo/python-list

Re: "Python Wizard," with apologies to The Who

2011-07-12 Thread Phlip
> That's pretty funny.  I knew what it would be even when I saw the cut-off > subject line, and I am too young to remember it. > > Carl Banks TTTO "[She put the lime in the] Coconut": Brother wrote a database, he finish it on time His sister add requirements, refactor every line She change

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread Phlip
On Jul 20, 10:32 am, rantingrick wrote: > Steven, you have no buisness offering advice on Tkinter since you > yourself have proclaimed that YOU NEVER used the module and never > will. Stick to what you know please. Allow me. Tkinter sucks because it looks like an enfeebled Motif 1980s dawn-of-

Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread Phlip
On Jul 20, 3:13 pm, sturlamolden wrote: > On 20 Jul, 22:58, Phlip wrote: > > > Tkinter sucks because it looks like an enfeebled Motif 1980s dawn-of- > > GUIs scratchy window with grooves and lines everywhere. > > The widget set is limited compared to GTK or Qt, though

Changing subject sucks. Re: I am fed up with Python GUI toolkits...

2011-07-20 Thread Phlip
On Jul 20, 6:17 pm, rantingrick wrote: > RE: *Ben Finney changes thread subject* > > Please everyone, do not change the subject of someone's thread because > it's considered rude. Thank you. No it isn't. Rambling off on a new topic under the wrong subject is rude. -- http://mail.python.org/mailm

Re: Snippet: The leanest Popen wrapper

2011-08-03 Thread Phlip
;fab not found" etc. when running 'fab command' thru it. So then I ditch to os.system(). The long-term solution would be 'bash', '-c', 'yack yack yack' if you want truly shelly things! --   Phlip   http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

filename of calling function?

2009-11-28 Thread Phlip
se and the except. Could be pilot error, of course. Thanks for any help! -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: filename of calling function?

2009-11-28 Thread Phlip
On Nov 28, 8:19 am, Phlip wrote: > Consider these two python modules: > > aa.py > > def a(): >     print '?' > > bb.py >   import aa > > def bb(): >   aa.a() > > bb() > > How do I make the print line emit the filename of bb.py? (It

Re: filename of calling function?

2009-11-28 Thread Phlip
On Nov 28, 9:04 am, Joel Davis wrote: > >         try: > >             raise None > >         except: > >             import sys > >             from traceback import extract_tb, extract_stack > >             frame = sys.exc_info()[2].tb_frame.f_back > >             calling_file = extract_stack(f

Re: Question on Python as career

2009-12-01 Thread Phlip
eting my Post Doc with present base of knowledge what profiles I may expect? How about videogames? They always need hard algorithms & computer science. -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: combinatorics via __future__ generators

2009-12-01 Thread Phlip
Awesome thanks - but: > from itertools import imap,product Do we have a version for Python2.5? I have to support an older server here; can't install a newer python on it... -- http://mail.python.org/mailman/listinfo/python-list

mock any instance

2009-12-14 Thread Phlip
http://python-mock.sourceforge.net/ if I should use a different mocker, I would prefer it behave like that mock, for aesthetic reasons, and also to avoid the need to replace all our existing Mocks with a new one, following the rule that we should not use too many classes to do the same thing (DRY)

how to register with pypi

2009-12-21 Thread Phlip
I try a key of some other algorithm? -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: how to register with pypi

2009-12-21 Thread Phlip
Martin v. Loewis wrote: I'm stuck on the "PGP Key ID". When I whip out my trusty Ubuntu and run pgp -kg, I get a 16-digit "DSA / EIGamal" key. When I enter it into http://pypi.python.org/pypi?%3Aaction=register_form , I get a helpful "PGP Key ID is invalid". Should I try a key of some other alg

Re: how to register with pypi

2009-12-21 Thread Phlip
If you have never used PGP before, you *really* shouldn't register a PGP key ID in PyPI. I suppose your key doesn't have any counter signatures, anyway. Nope, thanks, I'm already in. The pypi page could mark the field "optional". I just associated it, conceptually, with the Github SSH key, and

how to register with pypi - no such setup.py

2009-12-21 Thread Phlip
And the next question in the series - how to make sure the resulting package has a setup.py file? The basic steps are... - build a python package - create a minimal setup.py - (github it, natch) - throw it at pypi with: python setup.py bdist upload - attempt to install it with: s

how to register with pypi - no such setup.py

2009-12-22 Thread Phlip
And the next question in the series - how to make sure the resulting package has a setup.py file? The basic steps are... - build a python package - create a minimal setup.py - (github it, natch) - throw it at pypi with: python setup.py bdist upload - attempt to install it with: sud

Re: how to register with pypi - no such setup.py

2009-12-25 Thread Phlip
On Dec 24, 3:32 am, "Martin v. Loewis" wrote: > > Any tips? > > A binary distribution won't have a setup.py, because > you can install it by other means (such as Windows Installer), > instead of running setup.py > > What you want is a source distribution (sdist). Thanks. Yes, this is prob'ly docu

Re: how to register with pypi - no such setup.py

2009-12-26 Thread Phlip
On Dec 26, 6:01 am, "Martin v. Loewis" wrote: > > Now my next problem - how to get pypi.python.org to stop burning up > > version numbers each time I test this? > > I don't speak English well enough to understand what "to burn up" > means - to my knowledge, PyPI does no such thing. I don't know

Re: how to register with pypi - no such setup.py

2009-12-26 Thread Phlip
> I have no alternative, to fix bugs in PyPi, _not_ in "that file", but > to continue burning up version numbers that nobody cares about. The > message is condescending because I am aware of the reason we version > packages, and the message is _not_ helping me apply that reason! Aaand I just found

Re: how to register with pypi - no such setup.py

2009-12-28 Thread Phlip
On Dec 26, 4:24 pm, Stefan Krah wrote: > It is quite reasonable that changed archives with the same version number > are not accepted. Very helpful, not condescending. The message helps you remember to bump your version number. Try: "Please either increment your version number, or use your Pack

Re: Thanks for the help not given :)

2009-12-29 Thread Phlip
To the OP - adding "... because Python sucks" to your subject lines will increase the quantity of answers - but possibly not the quality. You can also learn a little about good questions by answering others's here. And I hope you answered your questions here, if no one else did, to avoid dead

change an exception's message and re-raise it

2009-12-31 Thread Phlip
e itself, and higher layers need to know this. My question is a common pattern in layered architectures, where exceptions get decorated with extra info as they bubble up from the engine room to the bridge. Any ideas? -- Phlip http://zeekland.zeroplayer.com/The_Elaborate_Art_of_Play_Part_1/1

Re: change an exception's message and re-raise it

2010-01-01 Thread Phlip
On Dec 31 2009, 4:30 pm, Steven D'Aprano wrote: > ...     1/0 > ... except ZeroDivisionError, e: > ...     e.args = e.args + ('fe', 'fi', 'fo', 'fum') > ...     raise When I added print e.args it showed the old args. Maybe I was trying too hard - this is why I said e seemed locked or something.

Re: change an exception's message and re-raise it

2010-01-01 Thread Phlip
On Dec 31 2009, 4:30 pm, Steven D'Aprano wrote: > For the record you can get the exception type from type(e): > > raise type(e)("whatever you want") > > but that creates a new exception, not re-raising the old one. Except if a type constructs with some other number of arguments, apparently... --

Re: How to validate the __init__ parameters

2010-01-04 Thread Phlip
way. But that newbie could be you! (And don't forget the wall-to-wall unit tests, too;) -- Phlip http://c2.com/cgi/wiki?MoreliaViridis -- http://mail.python.org/mailman/listinfo/python-list

Where's a DOM builder that uses the Builder Pattern to ... build DOMs?

2010-01-04 Thread Phlip
'text', name : 'password'}), html.INPUT({type : 'submit'}), ) ); Do anyone know any good DOM builder packages that do build DOM good like a DOM builder should? -- Phlip http://zeekland.zeroplayer.com/Uncle_Wiggilys_Travels/1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Where's a DOM builder that uses the Builder Pattern to ... build DOMs?

2010-01-05 Thread Phlip
On Jan 5, 12:16 am, Stefan Behnel wrote: > Note that there are tons of ways to generate HTML with Python. Forgot to note - I'm generating schematic XML, and I'm trying to find a way better than the Django template I started with! -- http://mail.python.org/mailman/listinfo/python-list

Re: twenty years ago Guido created Python

2010-01-05 Thread Phlip
two decades! The more languages you learn before getting to Smalltalk, the more awesome Smalltalk will be for you. -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

please help shrink this each_with_index() implementation

2010-01-05 Thread Phlip
Hypo Nt: def each_with_index(seq): index = 0 result = [] for item in seq: result.append([item, index]) index += 1 return result My Pythonic sequencing skills are obviously feeble. Can anything think of a way to write that in fewer lines? -- Phlip http://c2.com

Re: please help shrink this each_with_index() implementation

2010-01-05 Thread Phlip
just to locate that method? GMAB I'm too busy writing high-end Django via TDD & BDD! C-: -- Phlip http://zeekland.zeroplayer.com/Pigleg_Too/1 -- http://mail.python.org/mailman/listinfo/python-list

Re: please help shrink this each_with_index() implementation

2010-01-05 Thread Phlip
On Jan 5, 1:10 pm, Antoine Pitrou wrote: > http://docs.python.org/library/functions.html > > Don't forget that the Python documentation is rich and structured. > And good luck. Does it say how to convert a string containing either an integer representation, or something alphabetic, into an integ

Re: please help shrink this each_with_index() implementation

2010-01-05 Thread Phlip
> > Does it say how to convert a string containing either an integer > > representation, or something alphabetic, into an integer, or a zero, in > > like 1 method call? (No except: ?) > > If you mean something like this: > > >>> int('153') > > 153 The point: int('') or int('something') both throw

Re: Exception as the primary error handling mechanism?

2010-01-05 Thread Phlip
e-in-None-out, because Python decided which simplifications I should avoid with self-righteous indignation. The Samurai Principle (return victorious, or not at all) is very useful, sometimes. But other times it just prematurely depletes your supply of Samurai... -- Phlip http://zeekland.zeroplayer.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception as the primary error handling mechanism?

2010-01-05 Thread Phlip
On Jan 5, 5:01 pm, Chris Rebert wrote: > > Why can't int('nonnumeric') return None? > > Errors should never pass silently. You are saying I, as the programmer, cannot decide what is an error and what is a pass-thru. The decision is made for me. (Yes yes I can write int_or_None(), etc...) Here's

Re: unittest inconsistent

2010-01-05 Thread Phlip
On Jan 5, 4:14 pm, Matt Haggard wrote: > Can anyone tell me why this test fails? > > http://pastebin.com/f20039b17 > > This is a minimal example of a much more complex thing I'm trying to > do.  I'm trying to hijack a function and inspect the args passed to it > by another function. > > The reason

Re: Exception as the primary error handling mechanism?

2010-01-05 Thread Phlip
> Errors should never pass silently. > Unless explicitly silenced. > -- The Zen of Python (http://www.python.org/dev/peps/pep-0020/) "The person who says it cannot be done should never interrupt the person doing it" -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception as the primary error handling mechanism?

2010-01-06 Thread Phlip
On Jan 5, 8:49 pm, Steven D'Aprano wrote: > > (A related question - why can't I just go 'if record = method():  use > > (record)'. Why extra lines just to trap and assign the variable before > > using it?) > > Because that idiom is responsible for probably the most common error in C > of all, at

Re: Exception as the primary error handling mechanism?

2010-01-06 Thread Phlip
On Jan 5, 10:54 pm, Benjamin Kaplan wrote: > {41: None}[41] ? > > In cases where None is a valid result, you can't use it to signal failure. Asked and answered. You change the "sentinel" in .fetch to something else. But y'all keep on defending the language making your programming decisions for

Re: Exception as the primary error handling mechanism?

2010-01-06 Thread Phlip
Steve Holden wrote: y'all just keep defending the approach to programming that *you* think is best. Speak for yourself... -- http://mail.python.org/mailman/listinfo/python-list

Re: please help shrink this each_with_index() implementation

2010-01-06 Thread Phlip
Nobody wrote: On Tue, 05 Jan 2010 19:46:01 -0800, alex23 wrote: They will tell me how to use except: (which is a good example why a program should not use exceptions for its normal control flow if at all possible). Really? Magic functions that coerce and eat errors are a better coding techniqu

Re: Exception as the primary error handling mechanism?

2010-01-06 Thread Phlip
On Jan 6, 10:23 am, Lie Ryan wrote: > On 1/7/2010 3:41 AM, Phlip wrote: > > > Steve Holden wrote: > > >> y'all just keep defending the approach to programming that > >> *you* think is best. > > > Speak for yourself... > > Everyone speaks for

Re: Where's a DOM builder that uses the Builder Pattern to ... build DOMs?

2010-01-07 Thread Phlip
amp; expressive builder pattern I'm after would be very ... permissive & expressive. All I want is a library that reads my mind!!! Is that too much to ask??? (Unless if the library insists on throwing a NullMind exception, on principle...) -- Phlip http://twitter.com/Pen_Bird -- http://mail.python.org/mailman/listinfo/python-list

Re: Fundamental Function Question (beginner)

2010-01-11 Thread Phlip
MRAB wrote: Scott wrote: for prtnmS in open(portfpth): prtnmS = prtnmS.rstrip() There's nothing wrong with building dicts or other lookup tables outside a function in order to avoid re-creating them every time the function is called. However, please consider writing complete, pronoun

Re: What is built-in method sub

2010-01-11 Thread Phlip
it tests, including tests for the edge cases. (What if it's a \r\n? What if the \n is missing? etc.) That way I don't need to memorize re's exact behavior, and if I find a reason to swap in a .rstrip(), I can pass all the tests and make sure the substitution works the same. -- Phl

Re: Author of a Python Success Story Needs a Job!

2010-01-13 Thread Phlip
been consistently ignored. 6 years ago the silver bullet there was Java. Today, it is Rails. I happen to suspect Django has a superior architecture, but it's still RoR that's flying off the shelves these days. (And, under MERB's tutelage, they will soon surpass Django for modul

Re: Writing a string.ishex function

2010-01-14 Thread Phlip
MRAB wrote: BTW, ishex('') should return False. So should int('')! -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest help needed!

2010-01-14 Thread Phlip
should use a literate test runner, such as (>cough<) my Morelia project: http://c2.com/cgi/wiki?MoreliaViridis Down at the bottom, that shows how to create a table of inputs and outputs, and Morelia does the unrolling for you. -- Phlip http://zeekland.zeroplayer.com/Uncle_Wiggi

Re: Author of a Python Success Story Needs a Job!

2010-01-14 Thread Phlip
d if you install a full telecommuting rig of remote eyeballs, Skype with audio, and a remote desktop solution such as VNC, you can remotely pair very productively. (He posted from work, soloing! ;) -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing var names

2010-01-15 Thread Phlip
any other suggestions they've been holding back, >> or had mentioned earlier, on how to improve my design Write scads of unit tests! -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing var names

2010-01-15 Thread Phlip
et it to fail, then change the code as little as possible to get it to pass. Repeat until done, occasionally refactoring. If old code now works, just leave it alone. Until it needs a new feature, and then wham! it has tests. -- Phlip http://zeekland.zeroplayer.com/Uncle_Wiggilys_Travels/1 -- http://mail.python.org/mailman/listinfo/python-list

Re: BeautifulSoup

2010-01-15 Thread Phlip
... A> as Google vs China shows, all programmers should resist hacking, no matter how inept it may be, by any means necessary B> John should not have attempted to leave a dead trail in the archives. Searches for BeautifulSoup should always return answered questions. --

Re: BeautifulSoup

2010-01-17 Thread Phlip
John Nagle wrote: It's just somebody pirating movies. Ineptly. Ignore. Anyone who leaves their movies hanging out in tags, without a daily download limit or a daily hashtag, deserves to be taught a lesson! -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python not good enough?

2010-01-18 Thread Phlip
a shift and 2 characters for a very common operator. Pass! -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python not good enough?

2010-01-18 Thread Phlip
On Jan 18, 5:59 am, Anh Hai Trinh wrote: > > Go uses := for assignment. > > Except that it doesn't. := is a declaration. Ah, and that's why Go is easy for cheap parsers to rip. Tx all! I was formerly too mortified to proceed - now I'm back in the Go camp. They fixed the hideous redundancy of J

Re: Is HTML report of tests run using PyUnit (unittest) possible?

2010-01-19 Thread Phlip
to see how the --xml option works. (Then you'd use a XSL filter to rip the XML into HTML...) -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE for MacOS-X

2010-01-19 Thread Phlip
On Jan 18, 11:09 pm, Jean Guillaume Pyraksos wrote: > What's the best one to use with beginners ? > Something with integrated syntax editor, browser of doc... > Thanks, Before this message goes stale, there's TextMate (which I have too much experience with to consider redeemable in any way)...

Re: counting lines of code

2010-01-21 Thread Phlip
y experience with Python codebases that big... ...how many of those lines are duplicated, and might merge together into a better design? The LOC would go down, too. -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

Re: counting lines of code

2010-01-21 Thread Phlip
Aahz wrote: In article <7e09df6a-cda1-480e-a971-8f8a70ac4...@b9g2000yqd.googlegroups.com>, Phlip wrote: On Jan 20, 11:20=A0pm, Michele Simionato wrote: pylint does too many things, I want something fast that just counts the lines and can be run on thousands of files at once. cloc seem

Re: counting lines of code

2010-01-22 Thread Phlip
ys use executable cloc to measure the ratio of test to production code (where 1.2:1 is almost comfortable an 2:1 is sacred). Just so long as nobody confuses "more lines of code!" with progress... -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

where's self.assertMatch (for Django)?

2009-10-14 Thread Phlip
pretenders? Distractingly-yrs, -- Phlip http://zeekland.zeroplayer.com/Pigleg_Too/1 -- http://mail.python.org/mailman/listinfo/python-list

Re: where's self.assertMatch (for Django)?

2009-10-15 Thread Phlip
r = re.compile(pattern) self.assertNotEqual(None, r.search(smart_str(slug))) To do: Pass thru an optional diagnostic message. Anyone know why this is not in PyUnit? > -- >    Phlip >    http://zeekland.zeroplayer.com/Pigleg_Too/1 -- http://mail.python.org/mailman/listinfo/python-list

how to create a pip package

2009-11-09 Thread Phlip
link in here? Purely for posterity? Thanks! -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: how to create a pip package

2009-11-10 Thread Phlip
a setup.py. What is the absolute simplest setup.py to stick my project on the PYTHONPATH, and be done with it? [*but rest assured it has a developer test suite and a customer test script!] -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: how to create a pip package

2009-11-10 Thread Phlip
> >     from setuptools import setup, find_packages > > It will be enough to use the method outlined in the distutils > documentation. Setuptools is a third-party library that used to be the > de-facto standard for Python packaging. I don't want to go into detail > why setuptools might not be the b

Re: how to create a pip package

2009-11-10 Thread Phlip
except... will pip pull from a simple GitHub repo? or do I need to package something up and put it in a pythonic repository somewhere? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to create a pip package

2009-11-10 Thread Phlip
On Nov 10, 3:11 pm, Wolodja Wentland wrote: > The pip requirement file would contain the following line: > > -e git+git://example.com/repo.git#egg=rep I thought pip didn't do eggs. did I read a stale blog? > I hope this answers your questions :-D we are so close! Pages like this... htt

Re: how to create a pip package

2009-11-10 Thread Phlip
On Nov 10, 3:11 pm, Wolodja Wentland wrote: > The pip requirement file would contain the following line: > > -e git+git://example.com/repo.git#egg=rep > > I hope this answers your questions :-D Let me ask it like this. What happens when a user types..? sudo pip install repo Is github one of

Re: how to create a pip package

2009-11-10 Thread Phlip
> > -e git+git://example.com/repo.git#egg=rep Okay. -e is an argument to pip install. If anyone said that, I overlooked it. So, yes I can rip from github, just with a longer command line, for now. Tx! -- http://mail.python.org/mailman/listinfo/python-list

How can pip install a GitHub code drop?

2009-11-15 Thread Phlip
Not Hyp: Suppose I have a Python library, complete with a respectable setup.py. How can I point pip at the repo to install the library? if I use this... sudo pip -e git+git://github.com/Phlip/Kozmiq.git ...I get an editable drop in a ~/src/ folder. -- Phlip http://c2.com/cgi/wiki

combinatorics via __future__ generators

2009-11-18 Thread Phlip
eading 0 simply represents a slot with no options; the algorithm must preserve those. This should be child's play for the generator package, right? -- Phlip http://zeekland.zeroplayer.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: combinatorics via __future__ generators

2009-11-18 Thread Phlip
On Nov 18, 4:58 pm, Phlip wrote: > Python: > > I have a quaint combinatorics problem. Before I solve it, or find a > solution among "generators", I thought y'all might like to show off > any solutions. > > Given an array like this... > >

Re: Dreaming of new generation IDE

2010-02-03 Thread Phlip
On Feb 3, 3:10 am, Vladimir Ignatov wrote: > Finally I develop a feeling that strong instrumentation / tools can > bring us the best of two worlds. That I am dreaming on is an absolute > new type/class of IDE suitable for Python and potentially for other > dynamic-type languages. Instead of curre

Re: Dreaming of new generation IDE

2010-02-03 Thread Phlip
t.com/onlamp/blog/2008/05/dynamic_languages_vs_editors.html You just said that your code browsing "works pretty well, except when it doesn't". Hence my blog entry. If your editor analyzed your code at runtime, instead of just static analysis, then it could see tha

Re: The best library to create charting application

2010-02-03 Thread Phlip
mk wrote: The application will display (elaborate) financial charts. Pygame? Smth else? Back in the day it was Python BLT. Are you on the Web or the Desktop? -- Phlip http://www.oreillynet.com/onlamp/blog/2008/05/dynamic_languages_vs_editors.html -- http://mail.python.org/mailman

Re: Dreaming of new generation IDE

2010-02-03 Thread Phlip
with its tests. However, our editors must catch up to us. When I test, I am statically declaring a set of types, even if the language would prefer to dynamically fling them hither and yon. We should leverage that. -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

equivalent of Ruby's Pathname?

2010-02-03 Thread Phlip
join() and insert the / correctly, for example. What's the best equivalent in Python-land? -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

reconstruct the source of a lambda from its func_code, func_name, etc

2010-02-05 Thread Phlip
this option until someone suggests a better fix! -- Phlip http://penbird.tumblr.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: intolerant HTML parser

2010-02-08 Thread Phlip
type - is still useful to TDD generated code, because its XPath reference will detect that you get the nodes you expect. -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: intolerant HTML parser

2010-02-08 Thread Phlip
and the tweak is: parser = etree.HTMLParser(recover=False) return etree.HTML(xml, parser) That reduces tolerance. The entire assert_xml() is (apologies for wrapping lines!): def _xml_to_tree(self, xml): from lxml import etree self._xml = xml

Re: equivalent of Ruby's Pathname?

2010-02-08 Thread Phlip
cles/python/path # Author: Jason Orendorff (and others - see the url!) # Date:7 Mar 2004 class path(_base): """ Represents a filesystem path. """ Gods bless http://www.google.com/codesearch, huh?! -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: equivalent of Ruby's Pathname?

2010-02-08 Thread Phlip
hem the following sloka: Don't be clever don't be witty Or you'll wind up BEING the Committee! -- Phlip http://penbird.tumblr.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Phlip
rowth, Python still has no Pathname class. What a mature community! C-: -- Phlip http://c2.com/cgi/wiki?MoreliaViridis -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >