Re: Guessing the encoding from a BOM

2014-01-17 Thread Ethan Furman
On 01/17/2014 08:46 AM, Pete Forman wrote: Chris Angelico ros...@gmail.com writes: On Fri, Jan 17, 2014 at 8:10 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Slight aside, any chance of changing the subject of this thread, or even ending the thread completely? Why? Every time I see it I

Re: question about input() and/or raw_input()

2014-01-19 Thread Ethan Furman
On 01/19/2014 12:26 AM, Rustom Mody wrote: On Sunday, January 19, 2014 10:29:58 AM UTC+5:30, Chris Angelico wrote: On Sun, Jan 19, 2014 at 3:43 PM, Rustom Mody wrote: As do these pieces of code: -- def quux1(x): return str(x+1) -- def quux2(x): return hex(x+1)[2:] They do? -- quux1(2.3)

Re: question about input() and/or raw_input()

2014-01-19 Thread Ethan Furman
On 01/19/2014 08:38 AM, Chris Angelico wrote: On Mon, Jan 20, 2014 at 3:14 AM, Ethan Furman et...@stoneleaf.us wrote: -- def quux1(x): return str(x+1) -- quux1(2.3) '3.3' (Will be) fixed in 3.5 [1] :) [1] Which is to say, both will raise an exception. Why would that raise? Sorry, should

Re: question about input() and/or raw_input()

2014-01-19 Thread Ethan Furman
On 01/19/2014 10:41 AM, Chris Angelico wrote: On Mon, Jan 20, 2014 at 4:50 AM, Ethan Furman et...@stoneleaf.us wrote: The difference I was thinking of is: %h % 3.14 # this works vs. hex(3.14) # this raises In 3.5 both will raise. Now you have me *thoroughly* intrigued. It's not %h

Re: Add followers at time of import

2014-01-21 Thread Ethan Furman
On 01/21/2014 10:03 AM, Chris Angelico wrote: On Wed, Jan 22, 2014 at 4:52 AM, emile wrote: Ask if that's not clear. I'm not entirely sure, but I think this might have been meant for somewhere other than python-list. Welcome to the club. And it's an elite club, too! Very few members. ;)

Re: Diving in to Python - Best resources?

2014-01-21 Thread Ethan Furman
On 01/21/2014 08:00 AM, Rustom Mody wrote: Most people -- even those using spreadsheets -- dont seem to think of the spreadsheet macro language/VBA as a programming language Ack, are you trying to put him off programming again?!? ;) Python us fun and a pleasure to use. VBA is not. (IMNSHO

Re: awesome slugify and unicode

2014-01-22 Thread Ethan Furman
On 01/22/2014 11:23 AM, Mark Lawrence wrote: I thought this blog might interest some of you http://pydanny.com/awesome-slugify-human-readable-url-slugs-from-any-string.html Thanks! -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Case insensitive exists()?

2014-01-22 Thread Ethan Furman
On 01/22/2014 04:58 PM, Larry Martell wrote: I have the need to check for a files existence against a string, but I need to do case-insensitively. This should get you going. As it is, it will check the /entire/ string you send in even if it has path parts to it, and there are probably other

Re: buggy python interpretter or am I missing something here?

2014-01-26 Thread Ethan Furman
On 01/26/2014 10:42 PM, me wrote: My point of contention isn't so much about what specific syntax I should be using as much as it is about being allowed to use a syntax that gives erroneous results without triggering a syntax violation. If the bare except: clause is syntactically legal then it

Re: buggy python interpretter or am I missing something here?

2014-01-26 Thread Ethan Furman
On 01/26/2014 10:46 PM, me wrote: [...] I'm satisfied that the except: syntax yields undefined behavior, and in my mind it shouldn't be syntactically allowed then. Two points: 1) Python is not C++ 2) You asked for help; you received it. Coming back with an attitude of Python

Re: Highlighting program variables instead of keywords?

2014-01-27 Thread Ethan Furman
On 01/26/2014 06:54 PM, Roy Smith wrote: Chris Angelico wrote: That said, though, I grew up without syntax highlighting of any sort, and didn't think it particularly important; but now that I have editors with all those sorts of features, I do find them handy. Same here, except I'd replace

Re: UTC timezone causing brain explosions

2014-01-29 Thread Ethan Furman
On 01/29/2014 01:52 PM, Skip Montanaro wrote: Following up on my earlier note about UTC v. GMT, I am having some trouble grokking attempts to convert a datetime into UTC. Okay, let's see what GMT does for us: GMT = pytz.timezone(GMT) u = GMT.normalize(s) u datetime.datetime(2014, 1, 29, 21,

Re: Try-except-finally paradox

2014-01-30 Thread Ethan Furman
On 01/30/2014 10:12 AM, Rotwang wrote: On 30/01/2014 06:33, Andrew Berg wrote: On 2014.01.29 23:56, Jessica Ross wrote: I found something like this in a StackOverflow discussion. -- def paradox(): ... try: ... raise Exception(Exception raised during try) ... except: ...

Re: 1 0 == True - False

2014-01-30 Thread Ethan Furman
On 01/30/2014 11:03 AM, Chris Angelico wrote: On Fri, Jan 31, 2014 at 5:56 AM, Roy Smith wrote: Yes, that's probably how I would write that, although, this is even simpler: (x -1) and (y = 5) Be careful; that's not the same thing. How so? -- ~Ethan~ --

Re: __init__ is the initialiser

2014-01-31 Thread Ethan Furman
On 01/31/2014 11:33 AM, Mark Lawrence wrote: From http://docs.python.org/3/reference/datamodel.html#object.__init__ which states:- Called when the instance is created. The arguments are those passed to the class constructor expression. If a base class has an __init__() method, the derived

Re: __init__ is the initialiser

2014-01-31 Thread Ethan Furman
On 01/31/2014 11:52 AM, Ned Batchelder wrote: On 1/31/14 2:33 PM, Mark Lawrence wrote: From http://docs.python.org/3/reference/datamodel.html#object.__init__ which states:- Called when the instance is created. The arguments are those passed to the class constructor expression. If a base

Re: __init__ is the initialiser

2014-01-31 Thread Ethan Furman
On 01/31/2014 12:48 PM, MRAB wrote: On 2014-01-31 19:52, Ned Batchelder wrote: Why can't we call __init__ the constructor and __new__ the allocator? The advantage of calling it the initialiser is that it explains why it's called __init__. Hm, yes, good point. Also, __init__ initializes so

Re: __init__ is the initialiser

2014-01-31 Thread Ethan Furman
On 01/31/2014 03:43 PM, Ned Batchelder wrote: On 1/31/14 6:05 PM, Ben Finney wrote: Ned Batchelder writes: I'm not hoping to change any official terminology. I just think that calling __init__ anything other than a constructor is confusing pedantry. It is a constructor, and Python

Re: __init__ is the initialiser

2014-01-31 Thread Ethan Furman
On 01/31/2014 03:47 PM, Ben Finney wrote: I would prefer it to be clear that “__init__” is called automatically, *during* the constructor's operation. So, instead of: Called when the instance is created. I suggest: Called automatically by the constructor “__new__” during instance

Re: __init__ is the initialiser

2014-01-31 Thread Ethan Furman
On 01/31/2014 05:10 PM, Roy Smith wrote: In article mailman.6233.1391214984.18130.python-l...@python.org, Ethan Furman et...@stoneleaf.us wrote: I found calling __init__ the constructor very confusing. I've heard many people say this, and it's always sort of befuddled me. I have never

Re: __init__ is the initialiser

2014-01-31 Thread Ethan Furman
On 01/31/2014 07:16 PM, Terry Reedy wrote: On 1/31/2014 7:13 PM, Ethan Furman wrote: On 01/31/2014 03:43 PM, Ned Batchelder wrote: On 1/31/14 6:05 PM, Ben Finney wrote: Ned Batchelder writes: I'm not hoping to change any official terminology. I just think that calling __init__ anything

Re: __init__ is the initialiser

2014-01-31 Thread Ethan Furman
On 01/31/2014 06:28 PM, Terry Reedy wrote: Construct a house: Clear and grade house site. Bring in power and water. Built temporary structures. Built foundation. Built house on foundation. For most classes, __new__ stops with the foundation -- the bare object object (with the

Re: __init__ is the initialiser

2014-01-31 Thread Ethan Furman
On 01/31/2014 08:35 PM, Chris Angelico wrote: On Sat, Feb 1, 2014 at 2:42 PM, Steven D'Aprano wrote: Thus, two methods. __new__ constructs (creates, allocates) a new object; __init__ initialises it after the event. Yes, but if you think in terms of abstractions, they're both just steps in

Re: __init__ is the initialiser

2014-02-01 Thread Ethan Furman
On 01/31/2014 09:51 PM, Steven D'Aprano wrote: On Sat, 01 Feb 2014 15:35:17 +1100, Chris Angelico wrote: The two methods could have been done as a single method, __construct__, in which you get passed a cls instead of a self, and you call self=super().__construct__() and then initialize stuff.

Re: __init__ is the initialiser

2014-02-02 Thread Ethan Furman
On 02/02/2014 09:12 PM, Roy Smith wrote: In article mailman.6325.1391403799.18130.python-l...@python.org, Dave Angel da...@davea.name wrote: Skip Montanaro s...@pobox.com Wrote in message: On Sun, Feb 2, 2014 at 9:14 PM, Dave Angel da...@davea.name wrote: And when the q-bits get

Re: Latest Python 3.4 in the source repo is broken?

2014-02-04 Thread Ethan Furman
On 02/04/2014 07:45 AM, Steven D'Aprano wrote: Before I bother Python-Dev with this, can anyone else confirm that building Python 3.4 from source using the latest version in the source repository fails? This is the check-out I'm using: ethan@media:~/source/python/cpython$ hg parent

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Ethan Furman
On 02/06/2014 12:36 PM, Larry Martell wrote: On Thu, Feb 6, 2014 at 3:29 PM, Roel Schroeven wrote: msus...@gmail.com schreef: While editing this file I accidentally pushed TAB on the line with 'y = z + y'. My suggestion: configure your editor to insert the appropriate amount of spaces

Re: Finding size of Variable

2014-02-07 Thread Ethan Furman
On 02/07/2014 06:48 PM, Steven D'Aprano wrote: That is not a trade-off that the core developers have chosen to make, and I agree with them. Even though you haven't broken all the build-bots yet, you can still stop saying them. ;) -- ~Ethan~ --

Re: imperative mood in docstrings

2014-02-09 Thread Ethan Furman
On 02/09/2014 08:52 AM, Roy Smith wrote: In article mailman.6584.1391950328.18130.python-l...@python.org, bagrat lazaryan bagra...@live.com wrote: pep 257 -- docstring conventions, as well as a myriad of books and other resources, recommend documenting a function's or method's effect as a

Re: Fun with function argument counts

2014-02-11 Thread Ethan Furman
On 02/11/2014 05:05 PM, Chris Angelico wrote: On Wed, Feb 12, 2014 at 11:34 AM, Travis Griggs wrote: 6) Who writes a function with 19 mandatory arguments anyway subprocess._execute_child() and distutils.cygwincompiler._execute_child() Hmm. Those are internal functions (leading

Re: singleton ... again

2014-02-13 Thread Ethan Furman
On 02/13/2014 03:50 AM, Ned Batchelder wrote: On 2/13/14 4:00 AM, Piet van Oostrum wrote: Ben Finney ben+pyt...@benfinney.id.au writes: Gregory Ewing greg.ew...@canterbury.ac.nz writes: Roy Smith wrote: It looks to me like he's trying to implement a classic Gang of Four singleton pattern.

Re: singleton ... again

2014-02-13 Thread Ethan Furman
On 02/13/2014 09:57 AM, Roy Smith wrote: In article mailman.6850.1392313443.18130.python-l...@python.org, Ethan Furman et...@stoneleaf.us wrote: Say you have a class that represents serial ports or your computer. You should get the same object every time you ask for SerialPort(2). Why

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 10:37 AM, forman.si...@gmail.com wrote: I ran across this and I thought there must be a better way of doing it, but then after further consideration I wasn't so sure. if key[:1] + key[-1:] == '': ... Some possibilities that occurred to me: if key.startswith('') and

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 11:09 AM, Mark Lawrence wrote: All I can say is that if you're worried about the speed of a single line of code like the above then you've got problems. Having said that, I suspect that using an index to extract a single character has to be faster than using a slice, but I

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 11:20 AM, Ethan Furman wrote: On 02/13/2014 11:09 AM, Mark Lawrence wrote: All I can say is that if you're worried about the speed of a single line of code like the above then you've got problems. Having said that, I suspect that using an index to extract a single character has

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 11:17 AM, Neil Cerutti wrote: On 2014-02-13, forman.si...@gmail.com forman.si...@gmail.com wrote: I ran across this and I thought there must be a better way of doing it, but then after further consideration I wasn't so sure. if key[:1] + key[-1:] == '': ... Some possibilities

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 11:43 AM, Peter Otten wrote: forman.si...@gmail.com wrote: I ran across this and I thought there must be a better way of doing it, but then after further consideration I wasn't so sure. if key[:1] + key[-1:] == '': ... Some possibilities that occurred to me: if

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 01:01 PM, Chris Angelico wrote: On Fri, Feb 14, 2014 at 7:55 AM, Emile van Sebille em...@fenx.com wrote: On 2/13/2014 11:59 AM, Zachary Ware wrote: In a fit of curiosity, I did some timings: Snip of lots of TMTOWTDT/TIMTOWTDI/whatever... timed examples :) But I didn't see

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 02:13 PM, Chris Angelico wrote: On Fri, Feb 14, 2014 at 8:33 AM, Ethan Furman et...@stoneleaf.us wrote: Oh, it's not that bad! All you have to do is handle the edge case of an empty string: s[::len(s)-1 if s else True] And the edge case of the one-character string. Oops, my

Re: A curious bit of code...

2014-02-13 Thread Ethan Furman
On 02/13/2014 01:24 PM, Roy Smith wrote: Emile van Sebille wrote: But I didn't see this one: s[::len(s)-1] I love it. I need to add this to my list of Python trivia questions. Great interview question: What does this do? What is its weakness? How would you fix it? -- ~Ethan~ --

Re: Best practices to overcome python's dynamic data type nature

2014-02-14 Thread Ethan Furman
On 02/14/2014 08:10 AM, Sam wrote: Dynamic data type has pros and cons. It is easier to program but also easier to create bugs. What are the best practices to reduce bugs caused by Python's dynamic data-type characteristic? Can the experienced Python programmers here advise? Unit tests.

Re: Best practices to overcome python's dynamic data type nature

2014-02-14 Thread Ethan Furman
On 02/14/2014 08:54 AM, Marko Rauhamaa wrote: Here's some advice from a very experienced programmer: become a very experienced programmer. +1 QOTW -- https://mail.python.org/mailman/listinfo/python-list

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

2012-03-29 Thread Ethan Furman
Steven D'Aprano wrote: On Wed, 28 Mar 2012 14:28:08 +0200, Ulrich Eckhardt wrote: Hi! I'm currently writing some tests for the error handling of some code. In this scenario, I must make sure that both the correct exception is raised and that the contained error code is correct: try:

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

2012-03-30 Thread Ethan Furman
Steven D'Aprano wrote: To the degree that the decision of how finely to slice tests is a matter of personal judgement and/or taste, I was wrong to say that is not the right way. I should have said that is not how I would do that test. I believe that a single test is too coarse, and three or

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

2012-04-02 Thread Ethan Furman
Tim Rowe wrote: On 22 March 2012 19:14, Chris Angelico ros...@gmail.com wrote: In any case, though, I agree that there's a lot of people professionally writing code who would know about the 3-4 that you say. I'm just not sure that they're any good at coding, even in those few languages. All

remainder of dividing by zero

2012-04-12 Thread Ethan Furman
Okay, so I haven't asked a stupid question in a long time and I'm suffering withdrawal symptoms... ;) 5 % 0 = ? It seems to me that the answer should be 5: no matter how many times we add 0 to itself, the remainder of the intermediate step will be 5. Is there a postulate or by definition

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
Ian Kelly wrote: On Thu, Apr 19, 2012 at 3:33 PM, Terry Reedy tjre...@udel.edu wrote: On 4/19/2012 1:15 PM, Kiuhnm wrote: A with statement is not at the module level only if it appears inside a function definition or a class definition. This is true, I believe, of all statements. Am I

Re: syntax for code blocks

2012-04-28 Thread Ethan Furman
Kiuhnm wrote: I'd like to change the syntax of my module 'codeblocks' to make it more pythonic. Current Syntax: with res func(arg1) 'x, y': print(x, y) with res func(arg1) block_name 'x, y': print(x, y) New Syntax: with res == func(arg1) .taking_block (x,

Re: syntax for code blocks

2012-05-01 Thread Ethan Furman
Arnaud Delobelle wrote: On May 1, 2012 6:42 PM, Jerry Hill wrote: On Tue, May 1, 2012 at 1:07 PM, Kiuhnm wrote: If you had read the module's docstring you would know that the public version uses Are you aware that you've never posted a link to your module, nor it's docstrings? Are you also

__del__ and wisdom

2012-05-09 Thread Ethan Furman
Every time discussion about __del__ had come up I had thought to myself, yeah, but I'm being careful to not have reference loops -- /my/ classes are okay. and then... BITE! But hey, it wasn't a reference loop that got me, it was data being written back to disk after the disk portion had

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

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

2012-05-12 Thread Ethan Furman
Devin Jeanpierre wrote: On Fri, May 11, 2012 at 11:21 PM, Chris Angelico ros...@gmail.com wrote: There are times when you want to catch all exceptions, though. Top-level code will often want to replace exception tracebacks with error messages appropriate to some external caller, or possibly log

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

2012-05-12 Thread Ethan Furman
Karl Knechtel wrote: On Thu, May 10, 2012 at 9:33 AM, Andreas Tawn andreas.t...@ubisoft.com wrote: And there's also something like... return \n.join((: .join((str(k), str(self.__dict__[k]))) for k in self.__dict__)) which is a nice length, but I lose control of the order of the attributes

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

2012-05-16 Thread Ethan Furman
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 active, and if so not hit the disk to get the data; with PyPy (and

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 et...@stoneleaf.us 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

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

2012-05-16 Thread Ethan Furman
Tim Delaney wrote: On 17 May 2012 07:33, 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 active

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

2012-05-16 Thread Ethan Furman
Chris Angelico wrote: On Thu, May 17, 2012 at 9:01 AM, Ethan Furman et...@stoneleaf.us wrote: A record is an interesting critter -- it is given life either from the user or from the disk-bound data; its fields can then change, but those changes are not reflected on disk until .write_record

Re: A better contextlib.contextmanager

2012-05-24 Thread Ethan Furman
Michele Simionato wrote: but I am asking a question instead: should I add this feature to the next release of the decorator module? I think it would be an excellent addition to your module. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Scoping Issues

2012-05-25 Thread Ethan Furman
Andrew Berg wrote: On 5/24/2012 8:59 PM, Dave Angel wrote: so I fixed that, and got inconsistent use of tabs and spaces in indentation because you mistakenly used tabs for indentation. Not to start another tabs-vs.-spaces discussion, but tabs are perfectly legal indentation in Python.

DBF records API

2012-06-01 Thread Ethan Furman
I'm getting towards an actual non-beta release, which means even more tests, polishings, cleaning up of various things, and actual documentation. :) However, I am wondering about my current record API: Currently, one does things like: record.scatter_fields() or record.has_been_deleted

Re: DBF records API

2012-06-01 Thread Ethan Furman
MRAB wrote: On 01/06/2012 18:50, Ethan Furman wrote: I'm getting towards an actual non-beta release, which means even more tests, polishings, cleaning up of various things, and actual documentation. :) However, I am wondering about my current record API: Currently, one does things like

Re: DBF records API

2012-06-01 Thread Ethan Furman
Tim Chase wrote: On 06/01/12 19:05, Jon Clements wrote: On 01/06/12 23:13, Tim Chase wrote: dbf.scatter_fields *always* trump and refer to the method. I did think about *trumping* one way or the other, but both *ugh*. For the record, it sounded like the OP wanted to be able to use the

Re: Import semantics?

2012-06-08 Thread Ethan Furman
Dan Stromberg wrote: Did the import semantics change in cpython 3.3a4? I used to be able to import treap.py even though I had a treap directory in my cwd. With 3.3a4, I have to rename the treap directory to see treap.py. Check out PEP 420 -- Implicit Namespace Packages

Re: [Python-Dev] Import semantics?

2012-06-08 Thread Ethan Furman
Eric V. Smith wrote: On 6/8/2012 6:41 PM, Ethan Furman wrote: Dan Stromberg wrote: On Fri, Jun 8, 2012 at 3:16 PM, Ethan Furman wrote: Dan Stromberg wrote: Did the import semantics change in cpython 3.3a4? I used to be able to import treap.py even though I had a treap directory in my cwd

Re: using identifiers before they are defined

2012-06-12 Thread Ethan Furman
Julio Sergio wrote: Jose H. Martinez josehmartinezz at gmail.com writes: You should define the function first and then call it. def something(i): return i a = something(5) If you want a reference to the function somewhere else you can do this: I know that. That was what I meant

Re: using identifiers before they are defined

2012-06-12 Thread Ethan Furman
Julio Sergio wrote: Ethan Furman ethan at stoneleaf.us writes: No. The reply from MRAB explains this. ~Ethan~ Thanks, you're right! I was confusing statemens with declarations. Yeah, it took me a while to get that straight as well. ~Ethan~ -- http://mail.python.org/mailman/listinfo

Re: Academic citation of Python

2012-06-18 Thread Ethan Furman
Ben Finney wrote: Curt cu...@free.fr writes: On 2012-06-16, Christian Heimes li...@cheimes.de wrote: Actually it's van Rossum, Guido, not Rossum, Guido van. The van is part of the family name, not a middle name. It's like da Vinci, Leonardo or von Sydow, Max. On one occasion Guido complained

Re: exception problem

2012-06-28 Thread Ethan Furman
Charles Hixson wrote: On 06/25/2012 12:48 AM, Steven D'Aprano wrote: Catch any exception is almost certainly the wrong thing to do, almost always. This time it was the right thing No, it wasn't. If you hadn't caught it, Python would have printed it out for you, along with the full

Re: I can't send images to this mail-list

2012-06-29 Thread Ethan Furman
Ben Finney wrote: Chris Angelico writes: 梦幻草 wrote: why can't I send images to python-list@python.org?? It's a text-only list. I'll take this opportunity to give heartfelt thanks to the administrators for that policy; please keep this a text-only forum. +1000 --

Re: Question about weakref

2012-07-06 Thread Ethan Furman
Ian Kelly wrote: def del_b(self, b): for i, x in enumerate(self.array): if b is x: del self.array[i] break Nice work, Ian. -- http://mail.python.org/mailman/listinfo/python-list

API design question for dbf.py

2012-07-06 Thread Ethan Furman
I'm looking for some free advice. ;) My dbf module has three basic containers, all of which support list-like access: Table, List, and Index, each of which is filled with _DbfRecords. The fun part is that a _DbfRecord can compare equal to another _DbfRecord, a _DbfRecordTemplate, a tuple

Re: API design question for dbf.py

2012-07-06 Thread Ethan Furman
MRAB wrote: On 06/07/2012 22:34, Ethan Furman wrote: I'm looking for some free advice. ;) My dbf module has three basic containers, all of which support list-like access: Table, List, and Index, each of which is filled with _DbfRecords. The fun part is that a _DbfRecord can compare equal

Re: API design question for dbf.py

2012-07-06 Thread Ethan Furman
Devin Jeanpierre wrote: On Fri, Jul 6, 2012 at 6:46 PM, Ethan Furman et...@stoneleaf.us wrote: It's checking for equality, not identity. x = float('nan') x in [x] True It's checking for equality OR identity. Good point. In my case, checking for equality will cover both cases

Re: Python Interview Questions

2012-07-10 Thread Ethan Furman
Jean-Michel Pichavant wrote: Why would you want to hire someone that knows something pointless as the version where feature X has been introduced ? As an example from today, if someone claimed to have 5+ years of Python experience, but didn't know that 'with' was standard in 2.6 (or at least

Re: Python Interview Questions

2012-07-10 Thread Ethan Furman
Chris Angelico wrote: On Wed, Jul 11, 2012 at 2:34 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Of course, if they try to sell themselves as having five years experience with Python 3.2... ... then they've been borrowing Guido's time machine for personal purposes. Reminds

Re: Python professional certification

2012-07-13 Thread Ethan Furman
Mark Lawrence wrote: Google tells me that various certifications are available but I'd like to know if any of these are approved by the PSF or whoever would be responsible? If there's anything out there I've missed it :-( There is an O'Reilly Python Certification class offered in

Re: Implicit conversion to boolean in if and while statements

2012-07-16 Thread Ethan Furman
Steven D'Aprano wrote: On Sun, 15 Jul 2012 10:19:16 -0600, Ian Kelly wrote: On Sun, Jul 15, 2012 at 4:56 AM, Steven D'Aprano wrote: (For the record, I can only think of one trap for the unwary: time objects are false at *exactly* midnight.) Ugh, that's irritating. I can't think of any

Re: Implicit conversion to boolean in if and while statements

2012-07-16 Thread Ethan Furman
Andrew Berg wrote: On 7/15/2012 9:38 PM, Steven D'Aprano wrote: I would expect None to mean doesn't exist or unknown or something like that - e.g., a value of 0 means 0 jelly beans in the jar and None means there isn't a jar. How you interpret some_variable = None depends on what

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Ethan Furman
Andrew Berg wrote: To put it in duck-typing terms, why should everything have to quack like True or False? Sure, I can see why 1 quacks like True or [] quacks like False, but I don't see why say, a Logger or function should quack like either. Should a Thread object be True if it's been started

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Ethan Furman
Terry Reedy wrote: On 7/17/2012 10:23 AM, Lipska the Kat wrote: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and therefor debug 'type-bondage' is the requirement to restrict function inputs and output to one declared type,

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Ethan Furman
Mark Lawrence wrote: On 17/07/2012 18:29, Ethan Furman wrote: Terry Reedy wrote: On 7/17/2012 10:23 AM, Lipska the Kat wrote: Well 'type-bondage' is a strange way of thinking about compile time type checking and making code easier to read (and therefor debug 'type-bondage

Foxpro goto command and deleted records

2012-07-17 Thread Ethan Furman
In Foxpro if you do a GOTO 7 with deleted off and record 7 is deleted, the record pointer doesn't move (at least in version 6). I don't like that. I see four other options: 0) don't move the pointer (listed for completeness) 1) go to that record anyway 2) go to the next undeleted record 3)

Re: Foxpro goto command and deleted records

2012-07-17 Thread Ethan Furman
Ian Kelly wrote: On Tue, Jul 17, 2012 at 4:57 PM, Ethan Furman et...@stoneleaf.us wrote: In Foxpro if you do a GOTO 7 with deleted off and record 7 is deleted, the record pointer doesn't move (at least in version 6). I don't like that. I see four other options: 0) don't move the pointer

Re: Foxpro goto command and deleted records

2012-07-17 Thread Ethan Furman
MRAB wrote: On 17/07/2012 23:57, Ethan Furman wrote: In Foxpro if you do a GOTO 7 with deleted off and record 7 is deleted, the record pointer doesn't move (at least in version 6). I don't like that. I see four other options: 0) don't move the pointer (listed for completeness) 1) go

Re: Foxpro goto command and deleted records

2012-07-17 Thread Ethan Furman
MRAB wrote: On 18/07/2012 03:19, Ethan Furman wrote: MRAB wrote: On 17/07/2012 23:57, Ethan Furman wrote: In Foxpro if you do a GOTO 7 with deleted off and record 7 is deleted, the record pointer doesn't move (at least in version 6). I don't like that. I see four other options: 0) don't

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Ethan Furman
Lipska the Kat wrote: On 18/07/12 14:05, Steven D'Aprano wrote: Even with a break, why bother continuing through the body of the function when you already have the result? When your calculation is done, it's done, just return for goodness sake. You wouldn't write a search that keeps going after

Re: Foxpro goto command and deleted records

2012-07-18 Thread Ethan Furman
Ed Leafe wrote: On Jul 17, 2012, at 5:57 PM, Ethan Furman wrote: In Foxpro if you do a GOTO 7 with deleted off and record 7 is deleted, the record pointer doesn't move (at least in version 6). I don't like that. I see four other options: 0) don't move the pointer (listed for completeness

ANN: dbf.py 0.94

2012-07-20 Thread Ethan Furman
Getting closer to a stable release. Latest version has a simpler, cleaner API, and works on PyPy (and hopefully the other implementations as well ;), as well as CPython. Get your copy at http://python.org/pypi/dbf. Bug reports, comments, and kudos welcome! ;) ~Ethan~ --

Re: ANN: dbf.py 0.94

2012-07-20 Thread Ethan Furman
Steven D'Aprano wrote: On Fri, 20 Jul 2012 16:59:21 -0700, Ethan Furman wrote: Getting closer to a stable release. Excellent! That's fantastic news! I've been waiting for a stable release of dbf for months! I just have one question. What is dbf? :) dbf (also known as python dbase

Re: ANN: dbf.py 0.94

2012-07-21 Thread Ethan Furman
Steven D'Aprano wrote: This mailing list is about helping our fellow Python developers improve their skills and solve problems. That doesn't just mean *coding* problems, it also means helping them to write better documentation and promote their software better. Indeed it is, and your

Re: ANN: dbf.py 0.94

2012-07-21 Thread Ethan Furman
Simon Cropper wrote: Question 1 - What version of VFP will dbf work with? Is VFP9 OK? As long as you don't use auto-incrementing fields nor varchar fields you'll be fine. Question 2 - You statement of compatibility is unclear. Works with CPython 2.4 - 2.7. (Tested) Works with PyPy

Re: ANN: dbf.py 0.94

2012-07-21 Thread Ethan Furman
Chris Angelico wrote: On Sat, Jul 21, 2012 at 6:02 PM, Ethan Furman et...@stoneleaf.us wrote: Works with CPython 2.4 - 2.7. (Tested) Have you considered supporting 3.2/3.3 at all? It's often not difficult to make your code compatible with both. Or is there some dependency that is locked to 2

Re: ANN: dbf.py 0.94

2012-07-21 Thread Ethan Furman
Alex Strickland wrote: Hi Getting closer to a stable release. Latest version has a simpler, cleaner API, and works on PyPy (and hopefully the other implementations as well ;), as well as CPython. Get your copy at http://python.org/pypi/dbf. Bug reports, comments, and kudos welcome! ;)

Re: ANN: dbf.py 0.94

2012-07-23 Thread Ethan Furman
Ethan Furman wrote: Alex Strickland wrote: Not supported: index files: I have been using http://sourceforge.net/projects/harbour-project/ for years where a guy called Przemyslaw Czerpak has written an absolutely bullet proof implementation of NTX and CDX for DBF. Maybe it will interest you

Re: ANN: dbf.py 0.94

2012-07-23 Thread Ethan Furman
Chris Angelico wrote: On Sun, Jul 22, 2012 at 4:15 AM, Ethan Furman et...@stoneleaf.us wrote: I'll support 3.3+, but not with the same code base: I want to use all the cool features that 3.3 has! :) The trouble with double-codebasing is that you have double maintenance. But sure. So long

Re: Gender, Representativeness and Reputation in StackOverflow

2012-07-23 Thread Ethan Furman
Terry Reedy wrote: Leaving aside the point that this is not directly related to Python, my opinion is that if the authors will not make past and future papers freely available, not even an abstract, they should not ask for valuable free data from freely donated time. Thanks, Terry! Save me

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