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

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: 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

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: "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: "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: 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: 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 (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 (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: 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: 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: 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: 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: 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
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: 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-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-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
> >> 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
> - 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
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
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: [TIP] TestFixtures 1.8.0 Released!

2011-01-14 Thread Phlip
save(). The speed boost remained. I have no idea what farmdev fixture was doing to slow things down. Anyway thanks for the library, but you can see I can't use its fixture loader; I'm just putting this out here. But does it do Django models, and are they performant? -- Ph

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-25 Thread Phlip
many. Behavior Driven Development scenarios should be readable and not run-on. (Morelia has a table feature for when you actually need lots of arguments.) Next question: Does re.search() return a match object that I can get ('a', '', '', '', 'bbb', 'c') out of? The calls to groups() and such always return this crazy ('a', 2, 'bbb', 'c') thing that would disturb my user-programmers. -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-24 Thread Phlip
and." The match returns 'a, bbb, and c', but the groups return ('bbb', 'c'). What do I type for .groups() to also get the 'a'? Please go easy on me (and no RTFM!), because I have only been using regular expressions for about 20 years... -- Phlip http://bit.ly/ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Bunch 2.0 - a dict with a default

2010-11-18 Thread Phlip
value = kwargs.get('_default', None) if kwargs.has_key('_default'): del kwargs['_default'] class _DefMap(dict): def __init__(self, *a, **kw): dict.__init__(self, *a, **kw) self.__dict__ = self def __getitem__(self,

Re: How to make a method into a property without using the @property decorator

2010-10-23 Thread Phlip
On Oct 23, 8:01 am, Peter Otten <__pete...@web.de> wrote: > You may be better off with __getattr__(). Ayup, thanks. (Maybe I should have googled for "python equivalent of ruby method_missing", hmm?;) -- http://mail.python.org/mailman/listinfo/python-list

How to make a method into a property without using the @property decorator

2010-10-23 Thread Phlip
eading for a proxy pattern, where if you never call the generated prop, you never hit the database to load it into memory.) -- Phlip http://zeekland.zeroplayer.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how to scrutch a dict()

2010-10-21 Thread Phlip
> for k in [k for k, v in d.items() if v is None]: >   del d[k] Tx everyone! And I forgot about shadowing dict(), I forgot about del d[k], and I didn't know Python had "dict comprehensions" yet. Anyway this one might become the winner. -- http://mail.python.org/mailman/listinfo/python-list

how to scrutch a dict()

2010-10-20 Thread Phlip
s so often manage maps better than that... -- Phlip http://zeekland.zeroplayer.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: 3D cube navigation

2010-09-10 Thread Phlip
3d cube". Have fun! -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

Re: The Samurai Principle

2010-09-07 Thread Phlip
On Sep 7, 4:38 pm, Benjamin Kaplan wrote: > When you're using a language, you should use the style that the > language emphasizes. You mean like this? uri = reverse('my_uri_name', kwargs=dict(pk=record.pk)) That 'kwargs' there is ... a lapse of judgement. It is exposing a technical detail (t

Re: The Samurai Principle

2010-09-07 Thread Phlip
On Sep 7, 5:51 pm, Terry Reedy wrote: > On 9/7/2010 2:53 PM, Phlip wrote: > > > They are for situations which the caller should care not to handle. > > Python is simply not designed that way. Exception raising and catching > is a common flow-control method in Python. If

Re: The Samurai Principle

2010-09-07 Thread Phlip
On Sep 7, 6:23 pm, Lawrence D'Oliveiro wrote: > Does catching the exception not defeat the “Samurai Principle”? Read my comic: http://c2.com/cgi/wiki?SamuraiPrinciple Exceptions are very dangerous by themselves, because if you don't trap them just right they can cause side-effects. They are

Re: The Samurai Principle

2010-09-07 Thread Phlip
On Sep 7, 1:06 pm, Bruno Desthuilliers wrote: > try: >    return Model.objects.get(pk=42) > except Model.DoesNotExist: >    return sentinel Visual Basic Classic had a Collection Class, which worked essentially like a real language's Hash, Map, or Dict. Except - it had no operation to test membe

Re: The Samurai Principle

2010-09-07 Thread Phlip
On Sep 7, 11:36 am, Tim Chase wrote: > > And no it's not "much clearer". Exceptions are for catastrophic errors > > that the caller should care not to handle. A "record not found" is not > > a catastrophe. > > Exceptions are not limited to catastrophic errors, simply > exceptional (not the common

Re: The Samurai Principle

2010-09-07 Thread Phlip
On Sep 7, 10:36 am, Ian Kelly wrote: > On Tue, Sep 7, 2010 at 10:02 AM, Phlip wrote: > > Back to the topic, I tend to do this: > > >  for record in Model.objects.filter(pk=42): > >     return record > > >  return sentinel > > How is that any better th

Re: The Samurai Principle

2010-09-07 Thread Phlip
On Sep 7, 10:12 am, Bruno Desthuilliers wrote: > Phlip a écrit : > > > Back to the topic, I tend to do this: > > >   for record in Model.objects.filter(pk=42): > >      return record > > >   return sentinel > > WTF alert here... I don't see how an

Re: The Samurai Principle

2010-09-07 Thread Phlip
to the Django committees shortly... C-: -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

Re: The Samurai Principle

2010-09-07 Thread Phlip
> How does that compare to, say, the "Kamikaze Principle"? ;) Return victorious AND not at all! (All return values are packed up and thrown...;) -- http://mail.python.org/mailman/listinfo/python-list

The Samurai Principle

2010-09-06 Thread Phlip
Pythonistas: The "Samurai Principle" says to return victorious, or not at all. This is why django.db wisely throws an exception, instead of simply returning None, if it encounters a "record not found". I illustrated the value of that concept, here: http://c2.com/cgi/wiki?SamuraiPrinciple -- htt

Re: how to convert a sudsobject into its representative XML?

2010-06-18 Thread Phlip
The answer is to use ZSI instead, then call: sw = SoapWriter() sw.serialize(msg) -- http://mail.python.org/mailman/listinfo/python-list

[suds] how to convert a sudsobject into its representative XML?

2010-06-17 Thread Phlip
#x27;password' Okay, now call _what_, on or around auth, to convert it to its XML? I'm sure this is easy, because the SUDS internals must do this all the time, right? -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: regarding the dimensions in gui

2010-06-10 Thread Phlip
On Jun 10, 10:00 am, rantingrick wrote: > On Jun 10, 4:40 am, Jean-Michel Pichavant > wrote: > > > Internet rule, number 30: > > > "There are no girls on the internet" > > Well i hope at least your bedroom door does not still have that sign > hanging... > >  # >  #*      

Re: What's a good XSL to translate xmlrunner.py output into a test report?

2010-06-06 Thread Phlip
On Jun 3, 9:47 am, Phlip wrote: > Hypo Nt: > > Here's xmlrunner.py: > >  http://www.rittau.org/python/xmlrunner.py > > you attach it to your developer tests, and it emits a file called > "TEST-unittest.TestSuite.xml", containing auspicious

Re: Python Forum

2010-06-03 Thread Phlip
On Jun 3, 9:54 pm, Steven D'Aprano wrote: > I don't know what rubbish ISPs you're dealing with You've heard of a little fly-by-night outfit called AT&T? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Forum

2010-06-03 Thread Phlip
On Jun 3, 3:58 pm, geremy condra wrote: > On Thu, Jun 3, 2010 at 3:40 PM, Phlip wrote: > > On Jun 3, 3:20 pm, geremy condra wrote: > > >> > You mean like how I never get answers, to my super-easy GED-level > >> > questions, here??! > > >> I agr

Re: Python Forum

2010-06-03 Thread Phlip
On Jun 3, 3:20 pm, geremy condra wrote: > > You mean like how I never get answers, to my super-easy GED-level > > questions, here??! > > I agree. This proves conclusively that a web forum is the right > place for you. Ah, so you feel up to my "xsl for xmlrunner.py" question? -- http://mail.pyth

Re: Python Forum

2010-06-03 Thread Phlip
On Jun 2, 3:18 am, Adam Tauno Williams wrote: > +1 > > Yuck; no better way to make new users hate your product than have a web > forum - where they post questions Free of all the spam that leaks into here from the remnants of USENET!! > and never get answers... You mean like how I never ge

What's a good XSL to translate xmlrunner.py output into a test report?

2010-06-03 Thread Phlip
ly? All the bloggage on this seems to assume that everyone already knows this because _everyone_ graduated to Python thru Java... -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Phlip
On May 12, 3:03 pm, "Joel Koltner" wrote: > Pretty much, yeah... Realistically, we're probably talking less than a minute > each time, so objectively it's not really a big deal -- it's just different > than what I'm used to so I'm noticing it more. :-) > > I guess what I'm realizing here is that

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Phlip
On May 12, 1:38 pm, "Joel Koltner" wrote: > Well, sure, that is the current fix... but an "edit and continue" feature > would make for a much faster fix. :-) Are you implying, after an edit, you need to start a program again, then enter several user inputs, to navigate back to the place where yo

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Phlip
On May 12, 12:44 pm, "Joel Koltner" wrote: > I find myself making mistakes in typing the name of classes and/or methods > when I'm first getting started with them (there are some thousands of them > after all, and even of commonly used classes/methods you're probably talking > upwards of a hundre

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Phlip
On May 12, 10:42 am, "Joel Koltner" wrote: > Does any Python debugger support this feature? I have worked for >3 years by now in Python and have never once debugged. People who need "edit and continue" probably need developer tests instead. You typically edit the test a little, run all the code

Re: How to? epydoc --top=README

2010-05-12 Thread Phlip
On May 10, 1:29 pm, Phlip wrote: > Pythonistas: > > I have a question to epydoc-devel, but it might be languishing: > > http://sourceforge.net/mailarchive/forum.php?thread_name=l2n860c114f1... > > How do you populate the index.html output with your (insanely clever) > cont

Re: lame sphinx questions [Was: lame epydoc questions]

2010-05-11 Thread Phlip
> epydoc supports reStructured text markups. Oh, good. For a moment there, I thought I'd be stuck with a markup language that was persnickety! -- http://mail.python.org/mailman/listinfo/python-list

Re: lame sphinx questions [Was: lame epydoc questions]

2010-05-11 Thread Phlip
On May 11, 3:54 am, Jean-Michel Pichavant wrote: > I remember trying using Sphinx for auto documented APIs, but it was not > suitable at that time. You can include API docs generated from the code, > but you still need to write the docs around. > If I'm correct,  Sphinx is one of the best tool to

lame sphinx questions [Was: lame epydoc questions]

2010-05-10 Thread Phlip
On May 10, 1:51 pm, Phlip wrote: > On May 10, 1:39 pm, Chris Rebert wrote: > > > Sphinx is in vogue right now:http://sphinx.pocoo.org/ Okay, we have ten thousand classes to document. How to add them all to index.rst? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to? epydoc --top=README

2010-05-10 Thread Phlip
On May 10, 1:39 pm, Chris Rebert wrote: > Sphinx is in vogue right now:http://sphinx.pocoo.org/ > > It's used for the official docs and its results are quite pretty. The manager said to hold off on Sphinx until the next phase - then ran off to get married or something. But yet I persevere... --

[Epydoc-devel] How to? epydoc --top=README

2010-05-10 Thread Phlip
sers questions? -- yes-I-know-topicality-ly-yrs Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: csv.py sucks for Decimal

2010-04-23 Thread Phlip
On Apr 22, 6:15 pm, Jerry Hill wrote: > 10,10.0,10.00,"10" > > That's an int, a float, a Decimal and a string, all of which appear to > be formatted as I would expect. When you point your finger 'cause your plan fell thru you got three more fingers, pointing back at you! --Dire Straights -- htt

Re: csv.py sucks for Decimal

2010-04-23 Thread Phlip
On Apr 22, 5:03 pm, MRAB wrote: > It might be a stupid question, but have you tried passing in the > Decimal() object itself? Yep. Nope. Might as well (we ain't working today). But sorry, as usual, for my tone, and thanks all for playing! -- http://mail.python.org/mailman/listinfo/python-list

csv.py sucks for Decimal

2010-04-22 Thread Phlip
hat would allow Decimal() to do its job, unimpeded. Also, the CSV format should set its configurations per-column, not just per-file. -- Phlip http://zeekland.zeroplayer.com/Pigleg_Too/1 -- http://mail.python.org/mailman/listinfo/python-list

Re: "Usability, the Soul of Python"

2010-03-29 Thread Phlip
Python has > something to do with the usability it offers programmers. You mean like... Order.has_many :line_items ? Oops, sorry, wrong language. My bad! -- Phlip http://zeekland.zeroplayer.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Meaning of "monkey"

2010-03-26 Thread Phlip
On Mar 26, 6:14 am, Luis M. González wrote: > Webmonkey, Greasemonkey, monkey-patching, Tracemonkey, Jägermonkey, > Spidermonkey, Mono (monkey in spanish), codemonkey, etc, etc, etc... > > Monkeys everywhere. > Sorry for the off topic question, but what does "monkey" mean in a > nerdy-geek context

Re: Function that knows its argument's variable name

2010-03-16 Thread Phlip
hort time ago: http://groups.google.com/group/comp.lang.python/msg/03dd85ce009044e9 -- Phlip http://penbird.tumblr.com/ def assert_model_changes(self, mod, item, frum, too, lamb): source = open(lamb.func_code.co_filename, 'r').readlines() [lamb.func_code.co_firstlineno

Re: equivalent of Ruby's Pathname?

2010-03-16 Thread Phlip
f block: try: block() finally: previous.chdir() That's based on Jason Orendoff's work at http://www.jorendorff.com/articles/python/path -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: equivalent of Ruby's Pathname?

2010-03-10 Thread Phlip
tory similar to the C++ Boost project? All the nice-to- have classes that extend the core of C++ get to live in Boost before the C++ Committee pulls the best ideas off the top and add them to the Standard Library... -- Phlip http://penbird.tumblr.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary or Database—Please advise

2010-02-26 Thread Phlip
ests, then you have a bigger problem than memory requirements. (You can throw $50 hardware at that!) -- Phlip http://penbird.tumblr.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Docstrings considered too complicated

2010-02-26 Thread Phlip
it? Their unit tests are just as complete, illustrative, and administratively sanctioned, right? -- Phlip http://penbird.tumblr.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: When will Python go mainstream like Java?

2010-02-22 Thread Phlip
On Feb 22, 3:27 pm, Krister Svanlund wrote: > And when will be as famous as the Beatles? And when will http://mail.python.org/mailman/listinfo/python-list

Re: unit testing a routine that sends mail

2010-02-18 Thread Phlip
u are actually developing, so your tests should skip any irrelevant layers, and only test the layers where you yourself might add bugs. -- Phlip http://penbird.tumblr.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Which mock library do you prefer?

2010-02-17 Thread Phlip
Lacrima wrote: > I run my tests all the time (they almost replaced debugger in my IDE). > But there are times, when I can't just run tests after 1-3 lines of > code. ... > Maybe it's not proper TDD You are still being too literal. The "1-3 lines of code" guideline is a guideline, not a rule. It m

Re: Which mock library do you prefer?

2010-02-16 Thread Phlip
care in your tearDown() to scrub your environment. Google "Mock abuse" from here... -- Phlip -- http://mail.python.org/mailman/listinfo/python-list

Re: Which mock library do you prefer?

2010-02-16 Thread Phlip
aste of time. Do you run your tests after the fewest possible edits? Such as 1-3 lines of code? I'm not sure why the TDD books don't hammer that point down... -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: Which mock library do you prefer?

2010-02-15 Thread Phlip
edits, and always correctly predict if the tests will pass, or will fail, and with what diagnostic. (And configure your editor to run the stankin tests, no matter how hard it fights you!) The high-end tricks will get easier after you get the basic cycle down. -- Phlip http://c2.com/cgi/wiki?ZeekLand -- http://mail.python.org/mailman/listinfo/python-list

Re: Which mock library do you prefer?

2010-02-15 Thread Phlip
capsulation") to run as stubs, with some of their behaviors turned off. And if you TDD low-level code that hits a database, a mock would only tell the test what it wants to hear. And if you TDD high-level code that manages business rules, database records make perfectly good behaviora

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

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-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: 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: 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

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

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

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

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
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: 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: 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

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-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: 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: 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: 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 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: 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: 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: 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: 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

  1   2   >