Re: Enum vs OrderedEnum

2013-08-06 Thread Ethan Furman
_standard(): return 1.0 elif self.is_hostile(): return 0.5 elif self is self.fertile: return 1.5 elif self is self.gaia: return 2.0 else: raise AttributeError("Unknown growth_factor for %s" % self)

Re: Enum vs OrderedEnum

2013-08-06 Thread Ethan Furman
On 08/06/2013 04:46 PM, Ian Kelly wrote: On Aug 6, 2013 5:15 PM, "Ethan Furman" mailto:et...@stoneleaf.us>> wrote: Use the .value attribute instead. You could also substitute self for Environment. It feels more natural and readable to compare the enum instances rather t

Re: Bug? ( () == [] ) != ( ().__eq__([]) )

2013-08-07 Thread Ethan Furman
ty is not equal to a tuple that is empty, much like a car that is empty is not equal to a boat that is empty. -- ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing something on exception handling in Python 3

2013-08-26 Thread Ethan Furman
t block you won't see the chained exception in Python3. -- ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: How come StopIteration.__base__ is not BaseException?

2013-08-27 Thread Ethan Furman
On 08/26/2013 12:37 PM, Marco Buttu wrote: Since StopIteration is not an error, how come does it inherit directly from Exception and not from BaseException? Not all exceptions are errors. (Although not dealing with one can be. ;) -- ~Ethan~ -- http://mail.python.org/mailman/listinfo/python

Re: Encapsulation unpythonic?

2013-09-01 Thread Ethan Furman
On 09/01/2013 03:09 AM, Fabrice Pombet wrote: So I guess that we are actually all agreeing on this one. No, we are not. "encapsulation" != "inaccessible except by getters/setters" -- ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Encapsulation unpythonic?

2013-09-01 Thread Ethan Furman
On 09/01/2013 12:13 PM, Roy Smith wrote: In article , Ethan Furman wrote: On 09/01/2013 03:09 AM, Fabrice Pombet wrote: So I guess that we are actually all agreeing on this one. No, we are not. "encapsulation" != "inaccessible except by getters/setters" Noth

Re: Encapsulation unpythonic?

2013-09-01 Thread Ethan Furman
o me there is a difference between an underlying generic protocol for data manipulation and "Python writing them [getters/setters] for you". -- ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Encapsulation unpythonic?

2013-09-01 Thread Ethan Furman
On 09/01/2013 05:59 PM, Roy Smith wrote: Ethan Furman wrote: On 09/01/2013 02:54 PM, Tim Delaney wrote: Roy Smith wrote: Nothing is accessible in Python except via getters and setters. The only difference between Python and, say, C++ in this regard is that the Python compiler writes them

Re: How to split with "\" character, and licence copyleft mirror of ©

2013-09-02 Thread Ethan Furman
27;\'', but no: --> r'\'' "\\'" you get a backslash and a single-quote. And if you try to escape the backslash to get only one? --> r'\\' '' You get two. G. -- ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: to be pythonic: should caller or callee log?

2013-09-03 Thread Ethan Furman
return func(*args, **kwds) return wrapper Then you can say: class WhateverAccount: @log def transaction(self, amount, target): ... True, you still one line, but moves the logging concern outside the function, where it doesn't r

Re: Importing Definitions

2013-09-05 Thread Ethan Furman
ule2. from module1 import method1 which would mean from that point on I could just reference it as method1 rather than module1.method1, is there such a way I could do this with definitions?? from module1 import data1 -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Python KeyError

2013-09-06 Thread Ethan Furman
StackOverflow[0] or OpenERP's Q&A website[1]. [0] http://stackoverflow.com [1] http://help.openerp.com -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Language design

2013-09-11 Thread Ethan Furman
nt 'assert len(elts) == 1' ? -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Language design

2013-09-11 Thread Ethan Furman
)) True This is not a trap, this is simply the wrong way to do it. The magic methods (aka dunder methods) are there for Python to call, not you (except under special circumstances, such as when writing your own dunder methods). -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Language design

2013-09-12 Thread Ethan Furman
On 09/12/2013 10:51 AM, Markus Rother wrote: On 11.09.2013 23:15, Ethan Furman wrote: On 09/11/2013 01:41 PM, Markus Rother wrote: >>> () == [] False But: >>> bool(().__eq__([])) True This is not a trap, this is simply the wrong way to

Re: statsmodels.api

2013-09-16 Thread Ethan Furman
ot;C:\Python33\lib\site-packages\scipy\interpolate\interpolate.py", line 12, in import scipy.special as spec File "C:\Python33\lib\site-packages\scipy\special\__init__.py", line 529, in from ._ufuncs import * We'll need the rest of the traceback, as it will have the actual error. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Python variables? [was Re: class implementation]

2013-09-30 Thread Ethan Furman
ogram. This is partially incorrect. If the value referred to by the name is immutable, then it cannot change; perhaps you meant to say that which object the name points to can vary over time? -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: class implementation

2013-09-30 Thread Ethan Furman
On 09/30/2013 04:45 PM, Steven D'Aprano wrote: I can't speak for others, but in my own experience, I never *quite* understood the semantic differences between Python name bindings and Pascal variables until I came across the meme "Python has no variables". +1 -- https://mail.python.org/mailman

Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Ethan Furman
On 10/02/2013 07:46 AM, Νίκος wrote: Στις 2/10/2013 4:58 μμ, ο/η Ned Batchelder έγραψε: As others have said in this thread, this is not a Python topic. Find another forum for this question. Do not ask it here again. You've said that you can improve. Show us by not asking non-Python questions

Re: feature requests

2013-10-03 Thread Ethan Furman
e output queue (finished tasks). Have you verified that this is a problem in Python? Or does anyone know of a way to achieve this? You could try subclassing. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Literal syntax for frozenset, frozendict

2013-10-03 Thread Ethan Furman
ff by searching for previous threads discussing it, and summarise the arguments here? And then start a new thread. :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: API for custom Unicode error handlers

2013-10-04 Thread Ethan Furman
l... I change my mind, it shouldn't. Throw in a .enable() function and call it good. :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: feature requests

2013-10-05 Thread Ethan Furman
On 10/05/2013 05:49 AM, macker wrote: Ugly, menial lines are a clue that a function to hide it could be useful. Or a clue to add a trivial change elsewhere (hint for Ethan: `return self` at the end of `Thread.start()`). I'm aware that would solve your issue. I'm also aware t

Re: Python's and and Pythons or

2013-10-10 Thread Ethan Furman
ay, None, the some_list[0] would fail with an error (IndexError, TypeError, etc.). -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Python's and and Pythons or

2013-10-10 Thread Ethan Furman
ul to me then echo-argument and. first_element = some_list[0]# Oops, may crash some_list[0:1] always works, and sometimes is usable, but you still cannot index the slice. Not if some_list is None, False, or another non-indexable type. -- ~Ethan~ -- https://mail.python.org/mailman/lis

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Ethan Furman
That would certainly explain why it's hyper. ;) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Python's and and Pythons or

2013-10-10 Thread Ethan Furman
On 10/10/2013 06:41 PM, Terry Reedy wrote: On 10/10/2013 9:33 AM, Ethan Furman wrote: On 10/10/2013 12:43 AM, Terry Reedy wrote: On 10/10/2013 2:45 AM, Chris Angelico wrote: first_element = some_list[0]# Oops, may crash some_list[0:1] always works, and sometimes is usable, but you

Re: Skipping decorators in unit tests

2013-10-11 Thread Ethan Furman
events because an internal bug is usually counteracted by the rest of the system, except in some small number of cases. Directly testing the internal piece directly for the bug can be much easier than setting up the long and involved test. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Skipping decorators in unit tests

2013-10-11 Thread Ethan Furman
your own stuff so you should have control of your own decorators (okay, you may have to adapt a few others ;) . -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: when to use __new__, when to use __init__

2013-10-14 Thread Ethan Furman
self.x_length = x_length self.y_length = y_length SMALL_CICRLE = 100, 100 LARGE_ELLIPSE = 5000, 3000 ===== [1] enum34 is available on PyPI if you aren't able to move to Python3.4. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-17 Thread Ethan Furman
On 10/17/2013 01:57 PM, Ned Batchelder wrote: Read and listen more. Write and say less. Mark Janssen has no interest in learning. From a thread long-ago: Mark Janssen wrote: Ethan Furman wrote: Mark Janssen wrote: Really? --> int="five" --> [int(i) for i in ["1&

Re: Tkinter tutorial?

2013-10-22 Thread Ethan Furman
:D -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Confused about timezones

2013-10-23 Thread Ethan Furman
t Savings? Brain freeze! A quick glance told me they were the same, when they actually are different (68400, 64800). Sorry for the needless noise. Don't feel too bad, doesn't look like anybody else noticed either! ;) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Maintaining a backported module

2013-10-23 Thread Ethan Furman
y going to be the easiest thing to do as 2.7 has a bunch of 3.x features. Sadly, when I backported Enum I was targeting 2.5 - 3.x because I have systems still running 2.5. That was *not* a fun experience. :( -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Will Python 3.x ever become the actual standard?

2013-10-24 Thread Ethan Furman
On 10/23/2013 09:57 PM, Peter Cacioppi wrote: Moreover, you get a lot of the good stuff with 2.7. And the "good stuff" in 2.7 makes it easier to take that last step to 3.x when the time comes to do so. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Ethan Furman
On 10/24/2013 06:41 AM, Tim Daneliuk wrote: But now I feel bad about myself and it's all your fault. Really? *plonk* -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Ethan Furman
ll that, we can have disagreements without name calling. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Maintaining a backported module

2013-10-24 Thread Ethan Furman
On 10/24/2013 01:37 AM, Mark Lawrence wrote: On 24/10/2013 07:30, Ethan Furman wrote: On 10/23/2013 09:54 PM, Steven D'Aprano wrote: I'm looking for advice on best practices for doing so. Any suggestions for managing bug fixes and enhancements to two separate code-bases without them

Re: Python Coverage: testing a program

2013-10-24 Thread Ethan Furman
hat's neat (being able to exclude items) is there any reason to ever count the `if __name__ == '__main__'` clause? Are there any circumstances where it could run under Coverage? (Apologies if this is a dumb question, I know nothing about Coverage myself -- but I'm goi

Re: Basic Python Questions - Oct. 31, 2013

2013-11-01 Thread Ethan Furman
y're more along the lines of "power generators easily acquired". :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-02 Thread Ethan Furman
On 10/30/2013 01:32 PM, Gene Heskett wrote: Congratulations Jonas. My kill file for this list used to have only one name, but now has 2. You have more patience than I! Jonas just made mine seven. :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-02 Thread Ethan Furman
On 10/30/2013 12:23 PM, jonas.thornv...@gmail.com wrote: What i actually saying is that you are indeed... [insult snipped] *plonk* -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-ideas] os.path.join

2013-11-04 Thread Ethan Furman
first. Then os.path.join is probably the wrong tool for the job. Do you want to collapse "/foo/bar" + "../quux" into "/foo/quux"? That rewrites the first. If not, don't use a function that does that. Try simple string concatenation instead. Wrong mailing list. ;

Re: [Python-ideas] os.path.join

2013-11-04 Thread Ethan Furman
On 11/04/2013 09:29 AM, random...@fastmail.us wrote: I did, incidentally, notice a bug in macpath's *split* function; macpath.split(':foo::bar') should return (':foo::','bar') rather than (':foo:','bar'). Open a bug report. :) http:/

Re: To whoever hacked into my Database

2013-11-06 Thread Ethan Furman
part of the thread has made my day. I guess trolls can (rarely) have good side effects. :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-11 Thread Ethan Furman
On 11/11/2013 01:28 AM, wxjmfa...@gmail.com wrote: * Some languages are just fundamentally bad. The flexible string representation is a perfect exemple. Argh! He escaped! *chase* *scuffle* *stuff* *stuff* *stuff* Whew. Safely back in the troll bin. Okay, back to my day. -- ~Ethan

Re: datetime question

2013-11-11 Thread Ethan Furman
omatically adjust itself if DST happens? Yes, but the scarcity of universal whitespace is preventing me from posting it. Boy, are you in luck! I just happen to have a whole heap of marked down ascii white-space at bargain basement prices! -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Design thought for callbacks

2015-02-26 Thread Ethan Furman
On 02/26/2015 11:54 AM, Ian Kelly wrote: > Sometimes I wonder whether anybody reads my posts. It's entirely possible the OP wasn't ready to understand your solution four days ago, but two days later the OP was. -- ~Ethan~ signature.asc Description: OpenPGP digital signat

Re: Pyston 0.3 self-hosting

2015-02-27 Thread Ethan Furman
t;> http://blog.pyston.org/2015/02/24/pyston-0-3-self-hosting-sufficiency/ From their github site [1]: Currently, Pyston targets Python 2.7, only runs on x86_64 platforms, and only has been tested on Ubuntu. Support for more platforms -- along with Python 3 compatibility -- is desired bu

Re: Python Worst Practices

2015-02-27 Thread Ethan Furman
Sure, for the ones I use as built-ins. But I went through the color file for vim and took out the built-ins I use regularly as variables -- and 'id' was the first one to go. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Worst Practices

2015-02-28 Thread Ethan Furman
C# >> 86 : C++ >> > Does any language have more than COBOL? That has hundreds! I think Visual FoxPro should get at least an (dis)honorable mention -- I didn't count, but there are several page-fulls [1]. -- ~Ethan~ [1] https://msdn.microsoft.com/en-us/library/xztfc506%28v=vs.80%29.aspx signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

http: connection reset by peer

2015-03-03 Thread Ethan Furman
s, reverse date order for listings, auto-nosy -- nothing major. Any clues greatly appreciated. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: http: connection reset by peer

2015-03-04 Thread Ethan Furman
On 03/04/2015 01:26 AM, Chris Angelico wrote: > On Wed, Mar 4, 2015 at 5:33 PM, Ethan Furman wrote: >> >> I login to the roundup server -- I can search, create new issues, post new >> messages via both email and the web >> interface, and I can attach files... but

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-04 Thread Ethan Furman
On 03/04/2015 11:14 AM, Steven D'Aprano wrote: > > [...] > > > Wow -- a new level of succinctness! ;) -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: http: connection reset by peer

2015-03-05 Thread Ethan Furman
th a simpler harness (like a Python > program - see, on-topic now!). "The connection to the server was reset while the page was loading." After mucking about with it with no results, I went on to another job -- when I came back to this one it was working. -- ~Ethan~ signature

Re: Is nan in (nan,) correct?

2015-03-05 Thread Ethan Furman
False > >>> foo == bar > False > >>> quux = [foo, "spam"] > >>> "spam" in quux > True > >>> foo in quux > T

Re: Is nan in (nan,) correct?

2015-03-05 Thread Ethan Furman
On 03/05/2015 07:26 PM, Ben Finney wrote: > Ethan Furman writes: > >> On 03/05/2015 06:55 PM, Ben Finney wrote: >> >>> class NullType(object): >>> """ A type whose value never equals any other. >>> >>>

How fast does your grass grow? [was Re: HELP!! How to ask a girl out with a simple witty Python code??]

2015-03-05 Thread Ethan Furman
in the back -- that's a grass, isn't it? Hmmm, well, it grows fast enough that my dogs haven't managed to eat it gone yet. :) -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Is nan in (nan,) correct?

2015-03-06 Thread Ethan Furman
nctness of the > original! Not saying I will be able -- just that thats the claim Good luck. :) -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: __new__() does not return anything, on singletong pattern

2015-03-11 Thread Ethan Furman
de is good. The only question is if you /really/ need a singleton -- and only you can answer that (although plenty of folks will tell you you don't ;) . -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Function decorator having arguments is complicated

2015-04-26 Thread Ethan Furman
eturn x+y > > > How do you think about this idea? It's unnecessary, just use a class instead of a function to get more clarity. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Function decorator having arguments is complicated

2015-04-26 Thread Ethan Furman
On 04/27, Chris Angelico wrote: > On Mon, Apr 27, 2015 at 2:24 PM, Ethan Furman wrote: > > On 04/27, Makoto Kuwata wrote: > >> > >> I feel that function decorator having arguments is complicated, > >> because three 'def' are nested: >

Re: Function decorator having arguments is complicated

2015-04-27 Thread Ethan Furman
gt; log.log(level, message) > return func(*args, **kwargs) > return wrapper That is a cool trick, thanks for sharing! -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Clize 3.0b1: An argument parser that draws a CLI from your function sigature

2015-04-27 Thread Ethan Furman
the snippet with a given name. NAME the name of the snippet snippet put NAME SNIPPET Store a snippet with an associated name. NAME the name of the snippet SNIPPET the snippet text -- 8< -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Not possible to hide local variables

2015-04-28 Thread Ethan Furman
! ;) has a good reason to change those values in can be done, but it is quite clear that said user is mucking about with internals and they are on their own. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Looking for direction

2015-05-13 Thread Ethan Furman
noise for (account, staff), (item, qty, noise) in data.items(): do_stuff_with(account, staff, item, qty, noise) At the end, data should have what you want. It won't, however, be in the same order, so hopefully that's not an issue for you. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Survey -- Move To Trash function in Python?

2015-05-14 Thread Ethan Furman
that in the standard library, even if it meant that the library had feature-freeze and could gain no more functionality? Nope. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Survey -- Move To Trash function in Python?

2015-05-14 Thread Ethan Furman
On 05/14/2015 11:43 AM, Chris Warrick wrote: And if you are looking for a mostly-compliant Python library/app (and a shameless plug): https://pypi.python.org/pypi/trashman/1.5.0 The docs listed link to Package Builder. How is that related to TrashMan? -- ~Ethan~ -- https://mail.python.org

Re: pip grabs tar.gz file instead of whl?

2015-05-15 Thread Ethan Furman
-trusted-host in the future. Downloading numba-0.18.2.tar.gz (507kB) 100% || 507kB 373kB/s I particularly like how, when you specify --trusted-host, you still get all the warnings to use --trusted-host... not. -- ~Ethan~ -- https://mail.python.org/mailman

Re: fork/exec & close file descriptors

2015-05-19 Thread Ethan Furman
nge(max_files, -1, -1): if fd in keep: continue try: os.close(fd) except OSError: exc = sys.exc_info()[1] if exc.errno == errno.EBADF: continue raise So, yeah, basically a brute-force method. -- ~Ethan~ [1]

Re: Ah Python, you have spoiled me for all other languages

2015-05-22 Thread Ethan Furman
on't know if that's the reason why it was decided to be like that, or just a nice consequence of the choice to do it that way. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: What is considered an "advanced" topic in Python?

2015-05-29 Thread Ethan Furman
o: - support iterating: list(SomeEnum) --> [SomeEnum.first, SomeEnum.second, SomeEnum.third] - support a length: len(SomeEnum) --> 3 - not allow new instances to be created: --> SomeEnum(1) is SomeEnum(1) # True -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: What is considered an "advanced" topic in Python?

2015-05-29 Thread Ethan Furman
On 05/29/2015 02:06 PM, sohcahto...@gmail.com wrote: On Friday, May 29, 2015 at 10:18:29 AM UTC-7, Ethan Furman wrote: Metaclasses change the way a class behaves. For example, the new (in 3.4) Enum class uses a metaclass. class SomeEnum(Enum): first = 1 second = 2

Re: What is considered an "advanced" topic in Python?

2015-05-29 Thread Ethan Furman
On 05/29/2015 02:28 PM, Jason Swails wrote: ​[...] e.g., if the person creating an Enum subclass didn't bother to correctly implement [...] __iter__, and __len__ for their subclass For __iter__ and __len__ to work on the Enum /class/ it must be defined in the metaclass. -- ~Ethan~ --

Re: Using Python instead of Bash

2015-05-31 Thread Ethan Furman
raise SystemExit(attempt.returncode) Main() --8<-- Opinions about the usability of the above script, both as the script writer and as the user, welcomed. -- ~Ethan~ [1] yes, everyone apparently writes their own command-line processor -- this one is mine. ;) -- https://mail.python.org/mailman/listinfo/python-list

Re: Retrying to send message

2015-06-03 Thread Ethan Furman
On 06/03/2015 09:15 AM, Cecil Westerhof wrote: I kept the except. I like to see the message that went wrong. ;-) That's fine, but then add a `raise` after you print the error so you can see the reason that message failed. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Retrying to send message

2015-06-03 Thread Ethan Furman
On 06/03/2015 01:37 PM, Mark Lawrence wrote: On 03/06/2015 19:28, Ethan Furman wrote: On 06/03/2015 09:15 AM, Cecil Westerhof wrote: I kept the except. I like to see the message that went wrong. ;-) That's fine, but then add a `raise` after you print the error so you can see the reason

Re: Set a flag on the function or a global?

2015-06-15 Thread Ethan Furman
, and probably didn't, import) for only one function is overkill. edir.dunders = False # or True is simple, elegant, easier to type, and perfectly in keeping with Python's dynamic nature. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Set a flag on the function or a global?

2015-06-15 Thread Ethan Furman
butes on functions aren't normally meant to be changed by outside callers, I find this viewpoint surprising, since function attributes are fairly rare. it always feels wrong (they belong to the function itself). This seems silly -- a function is just another instance of some class. -- ~Eth

Re: Set a flag on the function or a global?

2015-06-15 Thread Ethan Furman
have separate entry points for filtering or not filtering the dunders. Something like: edir(obj) = no dunders edir_(obj) = dunders. `edir_` ? What a horrible name. I hate trailing underscores. Too easy to miss. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Set a flag on the function or a global?

2015-06-16 Thread Ethan Furman
On 06/16/2015 06:56 AM, Michael Torrie wrote: On 06/15/2015 06:19 PM, Ethan Furman wrote: Setting a global on the module (which I may not have, and probably didn't, import) for only one function is overkill. What do you mean? Even if you pull in just one function from the module

Re: Testing random

2015-06-16 Thread Ethan Furman
On 06/16/2015 06:01 PM, Chris Angelico wrote: The only instance of gambler's fallacy I'm seeing here is "PointedEars didn't understand the last dozen emails, so he's due to understand the next one". I've given up trying to explain. +1 QotW -- https://mail.python.org/mailman/listinfo/python-lis

converting boolean filter function to lambda

2015-06-25 Thread Ethan Furman
which works: filter(phone_found, main) # ['291.792.9000'] My attempt at a lambda function fails: filter(lambda p: (p in c for c in contacts), main) # ['291.792.9001', '291.792.9000'] Besides using a lambda ;) , what have I done wrong? -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: converting boolean filter function to lambda

2015-06-25 Thread Ethan Furman
On 06/25/2015 05:09 PM, Mark Lawrence wrote: On 26/06/2015 00:59, Chris Angelico wrote: On Fri, Jun 26, 2015 at 1:59 AM, Ethan Furman wrote: My attempt at a lambda function fails: filter(lambda p: (p in c for c in contacts), main) # ['291.792.9001', '291.792.9000'] Be

Re: (side-)effects and ...

2015-07-06 Thread Ethan Furman
call to a function that is given by a term such as »cos( 0 )« always has the /same/ value. The input to time() is the result of datetime.datetime.now(); is it datetime.datetime.now() that is being influenced by the world. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-13 Thread Ethan Furman
weak spot for me. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-15 Thread Ethan Furman
u fiddle with your object such that all instances hash to the same value then you lose the O(1) lookup for the dict -- you basically have a list. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Ethan Furman
hat's changing. Of this whole thread, though, I like the 'recurse' keyword proposal best -- I have no issues with the programmer specifying when to ditch the stack frame, but maybe that's my assembly roots showing. ;) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: A new module for performing tail-call elimination

2015-07-16 Thread Ethan Furman
all, if a routine can't handle a toy example, how is it going to handle real life?) With responses like these I can understand Antoon's position that folks are not arguing in good faith. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: A new module for performing tail-call elimination

2015-07-16 Thread Ethan Furman
definitely uglier and less easy to understand than the original (even if the original had had the error-checking). -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Ethan Furman
On 07/16/2015 12:14 PM, Joonas Liik wrote: You are giving the programmer a choice between "run out of stack and crash" and "mutilate interpreter internals and crash or zero out the hard drive" this is not a real choice.. +1 -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: A new module for performing tail-call elimination

2015-07-16 Thread Ethan Furman
On 07/16/2015 12:45 PM, Terry Reedy wrote: On 7/16/2015 2:02 PM, Ethan Furman wrote: On 07/16/2015 06:35 AM, Antoon Pardon wrote: Here is one way to do the odd, even example. def even(n): return odd_even('even', n) def odd(n): return odd_even('odd', n)

Re: Proposed keyword to transfer control to another function

2015-07-16 Thread Ethan Furman
ot;transfer f()" is equivalent to "return f()", except that the current function finishes before the target is entered. Sounds cool! Code it up and let us know how it goes. :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Ethan Furman
. Current candidates: "transfer", "goto", "recurse", and anything else you suggest. I propose the combination "return from". +1 -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Ethan Furman
On 06/05/2014 04:30 PM, Marko Rauhamaa wrote: What I'm afraid of is that the Python developers are reserving the right to remove the buffer and detach attributes from the standard streams in a future version. Being afraid is silly. If you have a question, ask it. -- ~Ethan~ --

Re: Python 3.2 has some deadly infection

2014-06-06 Thread Ethan Furman
ASCII was, in fact, an encoding was a big paradigm shift for me, but a necessary one. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.2 has some deadly infection

2014-06-06 Thread Ethan Furman
On 06/05/2014 09:32 AM, Steven D'Aprano wrote: But whatever the situation, and despite our differences of opinion about Unicode, THANK YOU for having updated ReportLabs to 3.3. +1000 -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: try/except/finally

2014-06-07 Thread Ethan Furman
t return, some kind of error ought to be raised. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: os.startfile hanging onto the launched app, or my IDE?

2014-06-09 Thread Ethan Furman
On 06/09/2014 03:21 PM, Josh English wrote: So this quirk is coming from PyScripter, which is a shame, because I don't think it's under development, so it won't be fixed. The nice thing about Python code is you can at least fix your copy. :) -- ~Ethan~ -- https://mail.pyt

<    7   8   9   10   11   12   13   14   15   16   >