dbf.py API question concerning Index.index_search()

2012-08-15 Thread Ethan Furman
one to it (adding, subtracting, etc), and the found status is lost. The other option is returning a (number, bool) tuple -- safer, yet more boring... ;) Thoughts? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: dbf.py API question concerning Index.index_search()

2012-08-15 Thread Ethan Furman
Tim Chase wrote: On 08/15/12 18:26, Ethan Furman wrote: .index_search( match, start=None, stop=None, nearest=False, partial=False ) The defaults are to search the entire index for exact matches and raise NotFoundError if it can't find anything. The questi

Re: dbf.py API question concerning Index.index_search()

2012-08-15 Thread Ethan Furman
Steven D'Aprano wrote: On Wed, 15 Aug 2012 16:26:09 -0700, Ethan Furman wrote: Indexes have a new method (rebirth of an old one, really): .index_search( match, start=None, stop=None, nearest=False, partial=False ) [...] Why "index_search" r

Re: type(None)()

2012-08-16 Thread Ethan Furman
Ramchandra Apte wrote: Are they the same object Yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: type(None)()

2012-08-16 Thread Ethan Furman
ror: cannot create 'NoneType' instances Why is that? An oversight, and until a few months ago nobody had complained loud enough. ;) Why doesn't it just return an existing instance of the type, like bool, int, str and other built-in non-mutable types do? In 3.3 it now does.

Re: dbf.py API question concerning Index.index_search()

2012-08-16 Thread Ethan Furman
MRAB wrote: On 16/08/2012 02:22, Ethan Furman wrote: Steven D'Aprano wrote: On Wed, 15 Aug 2012 16:26:09 -0700, Ethan Furman wrote: Indexes have a new method (rebirth of an old one, really): .index_search( match, start=None, stop=None, nearest=False, pa

Re: dbf.py API question concerning Index.index_search()

2012-08-16 Thread Ethan Furman
MRAB wrote: On 16/08/2012 17:13, Ethan Furman wrote: Currently there are: .index(data) --> returns index of data in Index, or raises error .query(string) --> brute force search, returns all matching records .search(match) --> binary search through table, returns all

Re: [ANNC] pybotwar-0.8

2012-08-16 Thread Ethan Furman
you feel irritated by it. I would've complained too if I was going to post a reply to this thread. Rest assured that in this (bottom-posting vs top-posting) Mark Lawrence speaks for many of us. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

python-list@python.org

2012-08-24 Thread Ethan Furman
Chris Angelico wrote: PLEASE add attribution back in. It's not about he-said/she-said, it's about honesty and clarity in reporting. It's far easier to understand the conversation when we know who said each part [. . .] +1 -- http://mail.python.org/mailman/listinfo/python-list

proper reply format [was Re: help with simple print statement!]

2012-08-24 Thread Ethan Furman
way as signature lines when I hit Reply. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: thanks! (was "Test message - please ignore")

2012-08-31 Thread Ethan Furman
Tim Chase wrote: On 08/31/12 09:15, Skip Montanaro wrote: We just upgraded the Mailman installation on mail.python.org. Part of that installation includes spam filtering on messages gated from Usenet to the python- l...@python.org mailing list. This message is a quick test of that function.

Re: Least-lossy string.encode to us-ascii?

2012-09-13 Thread Ethan Furman
comes "servico movil". Is there anything stock that I've missed? I can do mystring.encode('us-ascii', 'replace') but that doesn't keep as much information as I'd hope. I haven't yet used it myself, but I've heard good things about http://

Re: Comparing strings from the back?

2012-09-17 Thread Ethan Furman
*plonk* -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-18 Thread Ethan Furman
Neil Hodgson wrote: Ethan Furman: *plonk* I can't work out who you are plonking. While more than one of the posters on this thread seem worthy of a good plonk, by not including sufficient context, you've left me feeling puzzled. Is there a guideline for this in basic

technologies synergistic with Python

2012-09-21 Thread Ethan Furman
Greetings! What is the consensus... okay, okay -- what are some wide ranging opinions on technologies that I should know if my dream job is one that consists mostly of Python, and might allow telecommuting? (Please don't say Java, please don't say Java, please don't sa

Re: technologies synergistic with Python

2012-09-22 Thread Ethan Furman
Walter Hurry wrote: On Sat, 22 Sep 2012 10:58:38 -0700, Emile van Sebille wrote: On 9/21/2012 2:59 PM Ethan Furman said... ...if my dream job is one that consists mostly of Python, and might allow telecommuting? Hi Ethan, I have an open position in my two man office I've tried to f

Re: [Python-Dev] [RELEASED] Python 3.3.0 release candidate 3

2012-09-24 Thread Ethan Furman
Mark Lawrence wrote: On 24/09/2012 07:18, Georg Brandl wrote: [snip impressive list of improvements] Yes, but apart from all that, what have the python devs ever done for us? Nothing :) I'll take that kind of nothing any day of the week! ;) ~Ethan~ -- http://mail.python.org/ma

Re: A little morning puzzle

2012-09-24 Thread Ethan Furman
he dicts, which isn't even close to what was requested. With your comment of "Might be better ones, though", I actually thought that you were aware of this and were being intentionally satirical. Unlikely. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: For Counter Variable

2012-09-24 Thread Ethan Furman
e a better way, but for now, enumerate works pretty well. ROFLOL!! I look forward to the day when you look back on that statement and think, "Wow, I've come a long way!" ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Who's laughing at my responses, and who's not?

2012-09-24 Thread Ethan Furman
lf-editing. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Who's laughing at my responses, and who's not?

2012-09-24 Thread Ethan Furman
ese things, and instead blaming everyone else, is not insignificant. Being wrong is not fun, but learn from it instead of saying, "I'm not wrong, you just don't understand!" ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Article on the future of Python

2012-09-26 Thread Ethan Furman
wxjmfa...@gmail.com wrote: Py 3.3 succeeded to somehow kill unicode and it has been transformed into an "American" product for "American" users. *plonk* -- http://mail.python.org/mailman/listinfo/python-list

Re: Article on the future of Python

2012-09-26 Thread Ethan Furman
extremely useful contributor. I certainly prefer him to Xah Lee, who's attempts at improving Python documentation were beautifully torn to pieces here, IIRC by Ethan Furman, apologies to him and the actual author if I'm incorrect. I don't think it was me -- my troll tolerance is

Re: Article on the future of Python

2012-09-26 Thread Ethan Furman
Chris Angelico wrote: On Wed, Sep 26, 2012 at 10:19 PM, wrote: After all, if replacing a Nabla operator in a string take 10 times more times in Py33 than in Python32 [. . .] But I'll give you the benefit of the doubt; maybe your number is in binary. +1 QOTW -- http://mail.python.org/mailma

Re: Article on the future of Python

2012-09-27 Thread Ethan Furman
May I ask why? Or have I missed something? The second article didn't reference the first directly, but was aimed at that general type of article. At any rate, Steven wrote as if it were a direct response. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

instance.attribute lookup

2012-10-05 Thread Ethan Furman
thinking step 1 is flat-out wrong and doesn't exist. Does anybody know otherwise? ~Ethan~ [1] http://stackoverflow.com/q/10536539/208880 [2] http://www.cafepy.com/article/python_attributes_and_methods/ch01s05.html -- http://mail.python.org/mailman/listinfo/python-list

Re: instance.attribute lookup

2012-10-05 Thread Ethan Furman
Steven D'Aprano wrote: On Fri, 05 Oct 2012 10:39:53 -0700, Ethan Furman wrote: There is a StackOverflow question [1] that points to this on-line book [2] which has a five-step sequence for looking up attributes: > When retrieving an attribute from an object (print > objectna

Re: [ann] pysha3 0.2.1 released

2012-10-06 Thread Ethan Furman
lable on PyPI, too. [1] http://pypi.python.org/pypi/pysha3 [2] http://keccak.noekeon.org/ Nice! Thanks! ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: __setitem__ without position

2012-10-11 Thread Ethan Furman
was bound to before, it no longer is, because now it is bound to . What you are trying to do is mutate C, not rebind it. As Dave suggested, you can use slice notation ([:]) or some method of C (that you create) to do so. Basically i'm asking how to override, if i can,

Re: __setitem__ without position

2012-10-12 Thread Ethan Furman
lices just fine. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: a.index(float('nan')) fails

2012-10-28 Thread Ethan Furman
Steven D'Aprano wrote: The list.index method tests for the item with equality. Since NANs are mandated to compare unequal to anything, including themselves, index cannot match them. This is incorrect. .index() uses identity first, then equality, and will match the same NaN in a list. The OP

Re: Style help for a Smalltalk-hack

2012-10-28 Thread Ethan Furman
ap, valveSet=signatures)) 8<--- Don't forget to add error checking where appropriate. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: calling one staticmethod from another

2012-10-30 Thread Ethan Furman
;would you, could you', end='') Spam.green() It can be a pain if you change the class name, but it is certainly one way to do it. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Negative array indicies and slice()

2012-10-30 Thread Ethan Furman
slice arguments, instead of having to remember the offsets. record['full_name':'zip4'] returns a tuple (or a list, I don't remember) of about 13 fields -- this is especially useful as that block of fields might not be in the same place in each table. ~Ethan~ -- http:/

Re: Negative array indicies and slice()

2012-11-01 Thread Ethan Furman
lices -- one example has already been given in this thread. Hmmm. Now, I'm thinking -- The purpose of index(), specifically, is to notify when something which is not an integer may be used as an index; You've helpfully noted that index() also *converts* those objects into numb

Re: Negative array indicies and slice()

2012-11-01 Thread Ethan Furman
Chris Angelico wrote: On Fri, Nov 2, 2012 at 1:12 AM, Ethan Furman wrote: In other words, the slice contains the strings, and my code calculates the offsets -- Python doesn't do it for me. That's correct, but you're still translating those strings into numeric indices. True

Re: Negative array indicies and slice()

2012-11-01 Thread Ethan Furman
#x27;t tracked by gc; I'm not seeing an issue with not fixing the bug. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Multi-dimensional list initialization

2012-11-07 Thread Ethan Furman
After this post the only credibility you have left (with me, anyway) is that you seem to be willing to learn. So learn the way Python works before you try to reimplement it. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Multi-dimensional list initialization

2012-11-07 Thread Ethan Furman
are using numpy as it's common to use a list comprehension to initialise a numpy array. A more modest addition for the limited case described in this thread could be to use exponentiation: >>> [0] ** (2, 3) [[0, 0, 0], [0, 0, 0]] What would happen with --> [{}] ** (2, 3) o

Re: Multi-dimensional list initialization

2012-11-09 Thread Ethan Furman
Prasad, Ramit wrote: Dennis Lee Bieber wrote: Of course, if one has a language that, for some reason, evaluates right-to-left (APL, anyone), then x := x - x - x becomes x := x - 0 Is that not the same as x:=-x? No, its the same as 'x = x'. ~Etha

Re: stackoverflow quote on Python

2012-11-13 Thread Ethan Furman
wxjmfa...@gmail.com wrote: Le mardi 13 novembre 2012 06:42:19 UTC+1, Steven D'Aprano a écrit : On Tue, 13 Nov 2012 03:08:54 +, Mark Lawrence wrote: * strings are now proper text strings (Unicode), not byte strings; Let me laugh. *plonk* -- http://mail.python.org/mailman/listinfo/python-l

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-15 Thread Ethan Furman
wargs[k] = v.replace('_', '') return fn(*args) and this line ^ becomes return fn(*args, **kwargs) return wrapper ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-16 Thread Ethan Furman
bruceg113...@gmail.com wrote: On Thursday, November 15, 2012 11:16:08 PM UTC-5, Ethan Furman wrote: Emile van Sebille wrote: Using a decorator works when named arguments are not used. When named arguments are used, unexpected keyword error is reported. Is there a simple fix? Extend def

Re: Supporting list()

2012-12-17 Thread Ethan Furman
r use __iter__ and next to conform to the iterator protocol, or you can define __getitem__. If using __getitem__ it needs to work with integers from 0 to len(f)-1, and raise IndexError for len(f), len(f+1), etc. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Supporting list()

2012-12-17 Thread Ethan Furman
n you just need one __iter__() method, which returns self. The `next()` method is also needed, as `__iter__()` and `next()` are the two methods that make up the iterator protocol (`__next__` in python 3k). ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding while...else...

2013-01-22 Thread Ethan Furman
/want/ to use a while-else or for-else I only want the true/false check /once/, at the beginning of the loop. /Occasionally/ I'll actually have use for the search pattern, and then I can use the while- or for-else construct, but that's pretty rare for me. ~Ethan~ -- http://mail.pyt

Re: Retrieving an object from a set

2013-01-25 Thread Ethan Furman
know if there is a cleaner solution, and I quite like yours. Can you tell us, though, why you have to have y if x == y? Is there some subtle difference between the two equal objects? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Using an object inside a class

2012-01-23 Thread Ethan Furman
reference or will not work ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird newbie question

2012-01-26 Thread Ethan Furman
() IDLE is saying that my error is on line 4, at the second set of quotation marks. The code is for Python 2 -- are you using Python 3? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: except clause syntax question

2012-01-31 Thread Ethan Furman
ner for its component pieces -- some are just more general than others. Compare: location = (13, 4, 9)# line, word, char time = (10, 15, 41) # hour, minute, second result = ('this', 'that', 'huh') # result a, result b, result c with: record1 =

Re: Question about name scope

2012-02-01 Thread Ethan Furman
nctions you are actually going to use. ;) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about name scope

2012-02-01 Thread Ethan Furman
tion and assigning to locals() will not actually change the functions variables. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about name scope

2012-02-01 Thread Ethan Furman
Ethan Furman wrote: Ian Kelly wrote: I am not a dev, but I believe it works because assigning to locals() and assigning via exec are not the same thing. The problem with assigning to locals() is that you're fundamentally just setting a value in a dictionary, and even though it happens

Re: Question about name scope

2012-02-01 Thread Ethan Furman
Ian Kelly wrote: On Wed, Feb 1, 2012 at 3:24 PM, Ethan Furman wrote: Definitely should rely on it, because in CPython 3 exec does not un-optimize the function and assigning to locals() will not actually change the functions variables. Well, the former is not surprising, since exec was

Re: Question about name scope

2012-02-01 Thread Ethan Furman
Ian Kelly wrote: On Wed, Feb 1, 2012 at 4:41 PM, Ethan Furman wrote: I'm not sure what you mean by temporary: --> def f(x, y): ... frob = None ... loc = locals() ... loc[x] = y ... print(loc) ... print(locals()) ... print(loc) ... print(locals()) ... -

Re: Question about name scope

2012-02-01 Thread Ethan Furman
;frob', 'frob': None, 'loc': {...}} Seems to be stuck that way. Here is a better example I was thinking of: --> def f(x, y): ... locals()[x] = y ... locals()['x'] = 17 ... print(locals()) ... print(x) ... print(y) ... --> f('a', 42) {'y': 42, 'x': 'a', 'a': 42} a 42 So locals() was updated with 'a', but not with the assignment to 'x'. And of course, if we tried to 'print(a)' we'd get a NameError. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about name scope

2012-02-01 Thread Ethan Furman
Ethan Furman wrote: Ethan Furman wrote: Ian Kelly wrote: I am not a dev, but I believe it works because assigning to locals() and assigning via exec are not the same thing. The problem with assigning to locals() is that you're fundamentally just setting a value in a dictionary, and

Re: multiple namespaces within a single module?

2012-02-09 Thread Ethan Furman
print('inside b!') a.function() b.function() print(vars()) The NameSpace objects do *not* get their own copy of globals(), but for functions, etc., it should work fine. As a bonus the above code works for both 2.x and 3.x. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple namespaces within a single module?

2012-02-09 Thread Ethan Furman
) It would have to be `a.x = ...` and `b.x = ...` with corresponding `print(a.x)` and `print(b.x)`. Hrm -- and functions/classes/etc would have to refer to each other that way as well inside the namespace... not sure I'm in love with that... ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple namespaces within a single module?

2012-02-09 Thread Ethan Furman
Ethan Furman wrote: Hrm -- and functions/classes/etc would have to refer to each other that way as well inside the namespace... not sure I'm in love with that... Not sure I hate it, either. ;) Slightly more sophisticated code: class NameSpace(object): def __init__

OT (waaaayyyyyyyyy off-topic) [was Re: How can I catch misnamed variables?]

2012-02-10 Thread Ethan Furman
sad commentary on those who don't ascribe to a religion, as it would appear that they care less for their society. 2) altruism: unselfish regard for or devotion to the welfare of others... no mention of religion of any kind, or Jesus in particular. Altruistic-yet-paradoxically-religio

ANN: dbf.py 0.90.001

2012-02-10 Thread Ethan Furman
(although you can create temporary memory indices) - auto incrementing fields Latest version can be found on PyPI at http://pypi.python.org/pypi/dbf. Comments, bug reports, etc, appreciated! ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Kill files [was Re: OT: Entitlements [was Re: Python usage numbers]]

2012-02-15 Thread Ethan Furman
to give people second chances (and apparently third and fourth and fifth chances). Methinks it's time for Monsieur Johnson to go back in the killfile. Luckily for me there are enough folks that still reply to the trolls in my killfile that I can see if it's time to take them off or not.

Re: Is this the right list?

2012-02-16 Thread Ethan Furman
e list. There are lots of friendly folks here who will try to help. Unfortunately there are also a couple well-known trolls, one of whom is Rick Johnson (aka Ranting Rick). Please do not take his posts as representative of the community. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: A quirk/gotcha of for i, x in enumerate(seq) when seq is empty

2012-02-23 Thread Ethan Furman
nd, if you need it, x) before hand. Actually, i = -1 or his reporting will be wrong. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python math is off by .000000000000045

2012-02-27 Thread Ethan Furman
erested readers. I'm a casual interested reader and I have no idea what your post is trying to say. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about circular imports

2012-02-28 Thread Ethan Furman
OKB (not okblacke) wrote: Anyway, testing this just reinforced my distaste for circular imports. Just trying to think about how it ought to work with a importing c but then c and d importing each other makes my brain hurt. Refactoring the files so that common code is in a separate librar

Re: Python math is off by .000000000000045

2012-02-28 Thread Ethan Furman
xplanation. This should help you understand why you get errors doing simple things like x/y*y doesn't quite get you back to x. I already understood that. I just didn't understand what point he was trying to make since he gave no explanation. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: A possible change to decimal.Decimal?

2012-03-02 Thread Ethan Furman
ith reload() is probably not going to happen. What you should be doing is: import decimal from decimal import Decimal reload(decimal) Decimal = decimal.Decimal # (rebind 'Decimal' to the reloaded code) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: A possible change to decimal.Decimal?

2012-03-04 Thread Ethan Furman
A. Lloyd Flanagan wrote: On Friday, March 2, 2012 6:49:39 PM UTC-5, Ethan Furman wrote: Jeff Beardsley wrote: HISTORY: ... What you should be doing is: import decimal from decimal import Decimal reload(decimal) Decimal = decimal.Decimal # (rebind 'Decimal' to th

Re: A possible change to decimal.Decimal?

2012-03-04 Thread Ethan Furman
maybe. Appropriate -- no. It is unfortunate that those frameworks have that bug, but it is not up to Decimal to fix it for them. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: newb __init__ inheritance

2012-03-08 Thread Ethan Furman
ty: def __init__(self): A.__init__(self) or def __init__(self): super(B, self).__init__() or with Python 3 def __init__(self): super().__init__() ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to write this regular expression?

2012-03-08 Thread Ethan Furman
it is: Mouse - Right-click on title bar Left-click on Edit Left-click on Mark Right-click and drag to select desired text to copy text to clipboard Keyboard - e k or arrows to move cursor, to select text to copy text to clipboard ~Ethan~ -- http://mail.python.org/mailman/listinfo/p

stackoverflow question

2012-03-09 Thread Ethan Furman
time that attribute is accessed *on that instance* it will be in the instance dictionary, and that is what will be used. --- Thanks, ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: stackoverflow question

2012-03-10 Thread Ethan Furman
Terry Reedy wrote: Thanks for the review, Terry! On 3/9/2012 5:10 PM, Ethan Furman wrote: http://stackoverflow.com/q/9638921/208880 If anyone here is willing to take a look at it and let me know if I did not write it well, I would appreciate the feedback Here's the question

Re: stackoverflow question

2012-03-10 Thread Ethan Furman
Owen Jacobson wrote: On 2012-03-09 22:10:18 +, Ethan Furman said: Hey all! I posted a question/answer on SO earlier, but there seems to be some confusion around either the question or the answer (judging from the comments). http://stackoverflow.com/q/9638921/208880 If anyone here is

Re: avoid import short-circuiting

2012-03-16 Thread Ethan Furman
hat should not be too hard.. I believe sys.modules is a dictionary; you might try replacing it with your own custom dictionary that does whatever when the keys are accessed. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-16 Thread Ethan Furman
h Steven. Of course, it doesn't hurt that everything he has said matches with my experience on the topic. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-23 Thread Ethan Furman
Nathan Rice wrote: Logo. It's turtles all the way down. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Good web-development Python book

2012-03-23 Thread Ethan Furman
d, I completely overlooked that part of the post in my earnestness to answer… Completely understandable -- after all, who would not be earnest (and quick!) when replying to your surrogate god? ;) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Stream programming

2012-03-23 Thread Ethan Furman
like "stream programming", for example. ;) After the discussion I've seen so far, I still have no idea how I would use your code or what it's good for. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Ethan Furman
ut I actually also don't need to know - for my purposes, it would be perfectly good enough to deal with the ascii portions and keep anything else unchanged. Where is the data coming from? Files? In that case, it sounds like you will want to decode/encode using 'latin-1', as th

Re: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Ethan Furman
characters, not sure if that is because the source has none or something else. The 'ignore' argument to .decode() caused all non-ascii characters to be removed. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Ethan Furman
sting two distinct things, so you should write it as two separate tests: I have to disagree -- I do not see the advantage of writing a second test that *will* fail if the first test fails as opposed to bundling both tests together, and having one failure. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest: assertRaises() with an instance instead of a type

2012-03-30 Thread Ethan Furman
ecause they are redundant. Only remove them when they are obsolete due to changes in the code being tested. Very persuasive argument -- I now find myself disposed to writing two tests (not three, nor five ;). ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-04-02 Thread Ethan Furman
the best people I've ever known have had experience with quite a lot of languages. I know 10 languages. But I'm not telling you what base that number is :) There are 10 types of people in the world: those who know binary and those who don't. ;) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

remainder of dividing by zero

2012-04-12 Thread Ethan Furman
definition answer as to why this should not be so? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: remainder of dividing by zero

2012-04-13 Thread Ethan Furman
Ethan Furman wrote: Okay, so I haven't asked a stupid question in a long time and I'm suffering withdrawal symptoms... ;) 5 % 0 = ? Thanks for your replies, much appreciated. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: with statement

2012-04-19 Thread Ethan Furman
s and generator functions under the hood, so in principle there is nothing preventing with blocks from being injected into their byte code. Which would still not be at the module level. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax for code blocks

2012-04-28 Thread Ethan Furman
_func) Suggestions? I don't find either the current syntax nor the new syntax pythonic. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax for code blocks

2012-05-01 Thread Ethan Furman
ode you want people to critique, or posted a link to that code. He did post a link to a blog post describing his module and also a link to the actual code, on bitbucket IIRC. Actually, it was Ian Kelly that posted the blog reference. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

__del__ and wisdom

2012-05-09 Thread Ethan Furman
the disk portion had changed, thus clobbering new data with old. Yeah, I know, that's not really any better. *sigh* Okay, no more __del__ for me! ~Ethan~ Knowledge is knowing that tomatoes are a fruit. Wisdom is not putting them in a fruit salad. -- http://mail.python.org/mailman/listinfo/python-list

ANN: dbf version 0.92.002 released

2012-05-10 Thread Ethan Furman
Available at http://pypi.python.org/pypi/dbf Fixed issue with Memo fields not returning correct unicode data. Updated many docstrings. Nulls now fully supported. Getting closer to a 1.0 (non-beta!) release; working on PEP 8 compliance, index files, and actual documentation. Biggest change =

PyPI is being spammed

2012-05-10 Thread Ethan Furman
with Dr Sultan Spells of various natures. Can anybody put a stop to that? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

__all__, public API, private stuff, and leading _

2012-05-11 Thread Ethan Furman
Style question: Since __all__ (if defined) is the public API, if I am using that should I also still use a leading underscore on my private data/functions/etc? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: __all__, public API, private stuff, and leading _

2012-05-11 Thread Ethan Furman
Emile van Sebille wrote: On 5/11/2012 9:41 AM Ethan Furman said... Style question: Since __all__ (if defined) is the public API, if I am using that should I also still use a leading underscore on my private data/functions/etc? I would, even if only to alert any future maintainer of the

Re: Newbie naive question ... int() throws ValueError

2012-05-12 Thread Ethan Furman
or `map` in the list documentation. Kinda hard to get there without already knowing the answer. Unit tests. :) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Dealing with the __str__ method in classes with lots of attributes

2012-05-12 Thread Ethan Furman
t set Traceback (most recent call last): File "", line 1, in AttributeError: item >>> class Test2(Test1): ... def __init__(self, price): ... self.price = price ... >>> t2 = Test2(7.99) # __slots__ not defined in # subclas

cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-16 Thread Ethan Furman
zation; does anyone know what strings to look for for the other implementations? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-16 Thread Ethan Furman
Ian Kelly wrote: On Wed, May 16, 2012 at 3:33 PM, Ethan Furman wrote: Just hit a snag: In cPython the deterministic garbage collection allows me a particular optimization when retrieving records from a dbf file -- namely, by using weakrefs I can tell if the record is still in memory and

<    1   2   3   4   5   6   7   8   9   10   >