Re: Descriptors vs Property

2016-03-19 Thread Ethan Furman
complex to understand. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: sobering observation, python vs. perl

2016-03-20 Thread Ethan Furman
ta file and exact results the rest of us could try, but as it is all we can do is offer ideas and you have test them. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Static caching property

2016-03-21 Thread Ethan Furman
unc() The advantages: - only one location in the class - works correctly whether accessed via class or instance - clue as to functionality in the name -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: [Not actually OT] Trouble in node.js land

2016-03-23 Thread Ethan Furman
Does PyPI actually delete packages, as opposed to making them harder to find? I don't know the exact answer, but I do know there is a big warning label around the delete button: Do NOT use this button. There is no undo. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re:

2016-03-23 Thread Ethan Furman
different things) and am seeking a pythonic solution... If your keys are only numeric and True/False, you can check for and mutate True/False into strings "True"/"False" -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Effects of caching frequently used objects, was Re: Explaining names vs variables in Python

2016-03-25 Thread Ethan Furman
gt; v is w True If identity is not important, don't use `is`. A little late to the party, but: how about Ellipsis? Shouldn't "is" also be used for that one? (It's rare, I know :)) Ellipsis is a singleton, so `is` is fine. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: id == vs is

2014-10-26 Thread Ethan Furman
On 10/26/2014 05:23 PM, Ethan Furman wrote: On 10/26/2014 05:12 PM, Dan Stromberg wrote: Are the following two expressions the same? x is y Id(x) == id(y) ? Listen to MRAB, ignore me. That is all. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: id == vs is

2014-10-26 Thread Ethan Furman
On 10/26/2014 05:12 PM, Dan Stromberg wrote: Are the following two expressions the same? x is y Id(x) == id(y) ? Nope. If the value if `id(x)` is not interned, then the two value could be different objects that still represent the same value. -- ~Ethan~ -- https://mail.python.org

[ANN] dbf v0.96 is released

2014-10-28 Thread Ethan Furman
and finally supports Python 3! :) Versions supported are 2.5 - 2.7, and 3.2+ = dbf === dbf (also known as python dbase) is a module for reading/writing dBase III, FP, VFP, and Clipper .dbf database files. It's an ancient format that still finds lots of

Re: [ANN] dbf v0.96 is released

2014-10-28 Thread Ethan Furman
On 10/28/2014 01:08 PM, Tim Chase wrote: Just a little note to give thanks for all the work you put into such an unglamorous-yet-backside-saving project. It *is* appreciated by those of us who have had to disinter data from old client .dbf files. Thank you! :) -- ~Ethan~ -- https

Re: [ANN] dbf v0.96 is released

2014-10-28 Thread Ethan Furman
place! Although I usually leave off the version so the link is always to the most recent: https://pypi.python.org/pypi/dbf -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: optional types

2014-10-29 Thread Ethan Furman
uses them, they're not very useful. Even if it becomes official, which seems likely, it will still be optional -- hence, only useful if folks actually use it. ;) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

ANN: Antipathy v0.8

2014-10-30 Thread Ethan Furman
;> basename = basename + '_01' >>> new_name = os.path.join(path, basename+ext) wearing on your nerves? In short, are you filled with antipathy [1] for os.path? Then get antipathy and work with Path: >>> some_name = Path('/home/ethan/source/my_file.txt')

Re: __index__

2014-11-01 Thread Ethan Furman
d hex(), but in Python 3 __index__ is used. But I agree with Net that using a separate method is probably better. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: __index__

2014-11-01 Thread Ethan Furman
On 11/01/2014 11:29 AM, Ethan Furman wrote: But I agree with Net ... Oops, should have ben 'Ned' -- apologies! -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Ethan Furman
herits from 'object'. When you replace __call__ you need to replace it the class, not on the instance: setattr(__self__.__class__, self.newcall) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Ethan Furman
e __call__). -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Ethan Furman
On 11/04/2014 11:01 AM, Roberto Martínez wrote: (Ethan, sorry for posting to python-dev, I thought that it was an implementation detail of CPython 3.X) No worries. It's good practice to post here first, just in case. ;) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Ethan Furman
On 11/04/2014 11:23 AM, Nathaniel Smith wrote: (Or alternatively I guess you could go all in: Iä! Iä! Metaclasses Fhtagn!) Metaclasses aren't that bad! I've written one. And the dizzy spells are getting better! -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Real-world use of Counter

2014-11-05 Thread Ethan Furman
avoid unnecessary code churn (the fix itself is quite simple), the maintainer of the collections module wants to know if anybody has actually been affected by these inconsistencies, and if so, whether it was a minor inconvenience, or a compelling use-case. So, if this has bitten you, now is the time to speak up! :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Dinamically set __call__ method

2014-11-07 Thread Ethan Furman
On 11/06/2014 10:59 PM, dieter wrote: John Ladasky writes: On Tuesday, November 4, 2014 11:12:31 AM UTC-8, Ethan Furman wrote: If you really absolutely positively have to have the signature be correct for each instance, you may to either look at a function creating factory, a class creating

Re: [Python-Dev] Dinamically set __call__ method

2014-11-08 Thread Ethan Furman
On 11/07/2014 10:50 PM, dieter wrote: Ethan Furman writes: On 11/06/2014 10:59 PM, dieter wrote: John Ladasky writes: On Tuesday, November 4, 2014 11:12:31 AM UTC-8, Ethan Furman wrote: If you really absolutely positively have to have the signature be correct for each instance, you may

Re: [Python-Dev] Dinamically set __call__ method

2014-11-08 Thread Ethan Furman
st returns the descriptor and doesn't invoking the descriptor mechanism.) Looks like you found a bug in inspect.getargspec. And the thing going on is the normal python behavior (in __getattribute__, I believe) of examining the returned attribute to see if it is a descriptor, and if so inv

Re: [Python-Dev] Dinamically set __call__ method

2014-11-09 Thread Ethan Furman
On 11/09/2014 03:38 AM, Gregory Ewing wrote: Ethan Furman wrote: And the thing going on is the normal python behavior (in __getattribute__, I believe) of examining the returned attribute to see if it is a descriptor, and if so invoking it. Only if you look it up through the instance, though

Re: I don't read docs and don't know how to use Google. What does the print function do?

2014-11-10 Thread Ethan Furman
interested in learning how to program, but I know software engineers make lots of money so I want to be one. This post is a sine of the times. Don't go off on a tangent. Please! We don't need all this hyperbole! -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-11 Thread Ethan Furman
plan to me. :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: I love assert

2014-11-11 Thread Ethan Furman
ious whether one is using assert correctly) is: if all the asserts are removed, and my programs gets bad data, will it keep going as if it had gotten good data? Or, will it fail at the point it should have failed, or will it fail somewhere else? -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: I love assert

2014-11-11 Thread Ethan Furman
On 11/11/2014 01:09 PM, Albert-Jan Roskam wrote: Ethan Furman wrote: asserts are a specialized tool, easily abused. Sounds like you are using them exactly as intended. Would you say that assert is baaadly abused in nose?*) I never tried it, but probably all tests pass when Python is run

Re: I love assert

2014-11-11 Thread Ethan Furman
e one you checked for. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

html page mail link to webmail program

2014-11-11 Thread Ethan Furman
with a new compose window with the email address in place and the cursor in the subject line. Is this already done somewhere? If not, any ideas on which libs/packages to use to make it happen? -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: I love assert

2014-11-11 Thread Ethan Furman
On 11/11/2014 01:46 PM, Albert-Jan Roskam wrote: Ethan Furman wrote: I don't know, haven't used it nor read the code. It would certainly not be good if it failed in optimized mode. antonia@antonia-HP-2133 /tmp $ python -O test.py Ran 2 tests in 0.015s OK antonia@antonia-HP

Re: html page mail link to webmail program

2014-11-11 Thread Ethan Furman
On 11/11/2014 05:08 PM, Ben Finney wrote: Ethan Furman writes: My wife (using a Win7 machine) will be on a web page that has a link to mail somebody. She clicks on it, and it opens the currently installed but unused Thunderbird. Ideally, what would happen is a new window/tab would open to

Re: __missing__ for the top-level Python script

2014-11-12 Thread Ethan Furman
porting modules, by auto-importing them in response to usage. In theory, it's as simple as adding __missing__ to globals(), but I don't know of a way to do that for the main module. You might check out https://docs.python.org/3/library/sys.html#sys.excepthook -- ~Ethan~ -- https:

Re: How about some syntactic sugar for " __name__ == '__main__' "?

2014-11-12 Thread Ethan Furman
as before. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: I love assert

2014-11-12 Thread Ethan Furman
OT do. Imagine that a new status, CONFUSED is added, the above code is not modified to handle it, and for whatever reason the program is being run optimized -- the assert is not there, and CONFUSED is treated the same as WARNING. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: I love assert

2014-11-12 Thread Ethan Furman
something like: There's no way to make the CONFUSED status be handled without actually changing the code. The difference is that this version will not incorrectly treat CONFUSED as WARNING; it just won't do anything at all if the code is optimized. So, a different wrong thing, but still a wr

Re: I love assert

2014-11-12 Thread Ethan Furman
has been explained. Apparently you refuse to learn from that, but hopefully somebody else will. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: SSLsocket.getpeercert - request to return ALL the fields of the certificate.

2014-11-12 Thread Ethan Furman
talCode', '60603'),), (('stateOrProvinceName', 'Illinois'),), (('localityName', 'Chicago'),), (('streetAddress', '135 S La Salle St'),), (('organizationName', 'Bank of America

Re: How about some syntactic sugar for " __name__ == '__main__' "?

2014-11-13 Thread Ethan Furman
The return could be omitted to block the function from being manually called after import. This calls it at the wrong time, though. [...] One decorator that won't call too early is atexit.register(). -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: How about some syntactic sugar for " __name__ == '__main__' "?

2014-11-13 Thread Ethan Furman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/13/2014 12:33 PM, Ian Kelly wrote: > On Thu, Nov 13, 2014 at 11:32 AM, Ethan Furman wrote: >> On 11/12/2014 01:51 PM, Ian Kelly wrote: >>> >>> On Wed, Nov 12, 2014 at 2:33 PM, Chris Kaynor wrote: >>>>

Re: I love assert

2014-11-14 Thread Ethan Furman
a panacea. Right -- and using it is like using a rock when what you need is a ball-peen hammer. ;) - -- ~Ethan~ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBAgAGBQJUZkdzAAoJENZ7D1rrH75Nl9YQALx9UIAxYzlzH04EoMlILErb 0wz5xNhTM2JmF3csJPi3pQSpEr1XpHhW

Re: I love assert

2014-11-14 Thread Ethan Furman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/14/2014 11:12 AM, Marko Rauhamaa wrote: > Ethan Furman wrote: > >> My point being: a safety net that is so easily disabled does not count >> (IMHO) as a backup. > > Correct. You never lean on assertions. They are p

Re: I love assert

2014-11-14 Thread Ethan Furman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/14/2014 06:58 PM, Steven D'Aprano wrote: > Ethan Furman wrote: >> >> My point being: a safety net that is so easily disabled does not count >> (IMHO) as a backup. > > Assertions are not a backup or a safety

Re: I love assert

2014-11-16 Thread Ethan Furman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/16/2014 06:09 PM, Steven D'Aprano wrote: > Ethan Furman wrote: >> On 11/14/2014 06:58 PM, Steven D'Aprano wrote: >>> Ethan Furman wrote: >>>> >>>> My point being: a safety net that is so eas

Re: Different behaviour in list comps and generator expressions

2014-11-17 Thread Ethan Furman
e impact the other? It's not the eagerness vs. laziness that's being changed, but rather what happens in a generator when something inside the generator raises StopIteration (as opposed to the generator itself simply return'ing and thereby causing a StopIteration to be generated).

Re: Potential pitfalls when going from old-style to new-style classes

2014-11-19 Thread Ethan Furman
> classes. Under what circumstances might this be problematic? One problem is if your class has dunder methods on the instance -- they will be ignored. class Foo(object): def __init__(self): self.__add__ = lambda : 'whatever' dunder methods are looked up on the class.

Re: python 2.7 and unicode (one more time)

2014-11-20 Thread Ethan Furman
es it even mean to decode a Unicode string? > That's where the problem is. Fortunately that's one that Py3 solved - > str simply doesn't have a decode() method. If your unicode string happens to contain a base64 encoded .png, then you could decode that into bytes. ;) -- ~Etha

Re: Infinitely nested containers

2014-11-22 Thread Ethan Furman
ing does. > > It works fine now (Python 3.3). > > py> L = [] > py> t = (L, None) > py> L.append(L) > py> L.append(t) # For good measure. > py> print(t) > ([[...], (...)], None) This is a tuple in a list in a tuple, not a tuple in a tuple. --

Re: bug or feature in enum34 py2.7 backport?

2014-11-26 Thread Ethan Furman
of core 2.7 that follow that philosophy -- and if there aren't, it's extremely unlikely to change now. However, enum34 has now been updated to handle unicode class names. Thanks for the bug report. :) -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- http

Re: I love assert

2014-11-29 Thread Ethan Furman
he point that building an intricate error-reporting, program restarting framework on top of 'assert' is ridiculous. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: I love assert

2014-11-30 Thread Ethan Furman
that building that framework on assert, which can be unknowingly disabled by the end-user, is foolish. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Setting default_factory of defaultdict to key

2014-12-01 Thread Ethan Furman
): ... def __missing__(self, key): ... self[key] = self.default_factory(key) ... return self[key] ... and in action: --> huh = defaultdictkey(lambda k: k) --> huh defaultdict( at 0x7fe1305de3f0>, {}) --> huh['x'] 'x' --> huh['x'] 'x'

Re: Setting default_factory of defaultdict to key

2014-12-01 Thread Ethan Furman
On 12/01/2014 10:29 AM, Larry Martell wrote: > On Mon, Dec 1, 2014 at 1:19 PM, Ethan Furman wrote: >> On 12/01/2014 10:05 AM, Larry Martell wrote: >>> >>> Is there a way to set the default_factory of defaultdict so that >>> accesses to undefined keys get

Re: How about some syntactic sugar for " __name__ == '__main__' "?

2014-12-01 Thread Ethan Furman
On 11/13/2014 10:32 AM, Ethan Furman wrote: > On 11/12/2014 01:51 PM, Ian Kelly wrote: >> On Wed, Nov 12, 2014 at 2:33 PM, Chris Kaynor wrote: >>> >>> A decorator is an interesting idea, and should be easy to implement (only >>> lightly tested): >>> &g

Re: How about some syntactic sugar for " __name__ == '__main__' "?

2014-12-01 Thread Ethan Furman
On 12/01/2014 03:19 PM, Ethan Furman wrote: > > Well, I've tried this out, and it's only okay. As soon as interesting things > start happening, spurious errors about > thread IDs start printing, which really messes up the user experience [...] So here's another th

Re: How about some syntactic sugar for " __name__ == '__main__' "?

2014-12-02 Thread Ethan Furman
On 12/01/2014 05:15 PM, Chris Angelico wrote: > On Tue, Dec 2, 2014 at 11:45 AM, Ethan Furman wrote: >> >> Put the above somewhere in your path (e.g. /usr/local/bin), make it >> executable, and then instead of shebanging your >> scripts with `/usr/local/bin/python`

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Ethan Furman
> Never going to happen, but I like it! Perhaps raise IntimidationError > instead of AssertionError when it fails? As long as when raising Intimidation, it also roughs up a couple surrounding lines as a warning to the rest of the code... -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Style question: Importing modules from packages - 'from' vs 'as'

2014-12-04 Thread Ethan Furman
g great idea"). But, "Flat is better than nested" ! ;) -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Style question: Importing modules from packages - 'from' vs 'as'

2014-12-04 Thread Ethan Furman
> > Which one would you recommend? Does it depend on context? I recommend the one with less typing. ;) -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Do you like the current design of python.org?

2014-12-04 Thread Ethan Furman
gle to find the CLA form, because the built-in search box couldn't (and yes, it's on the site). -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Do you like the current design of python.org?

2014-12-09 Thread Ethan Furman
opular because they require hard work and discipline to achieve and education to be appreciated. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: is_ as method or property?

2014-12-11 Thread Ethan Furman
> > So, a classic method or a property, which one is the Pythonic 3 way for > such member predicates? Generally, attributes (and properties look like attributes) are for items that the object already knows the answer to, and methods are for things that need to be calculated, and may chan

Re: Portable code: __import__ demands different string types between 2 and 3

2014-12-15 Thread Ethan Furman
is point some_var is unicode in both Pythons -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Portable code: __import__ demands different string types between 2 and 3

2014-12-15 Thread Ethan Furman
ound it for previous versions, unless you can say you only support 2.7.10+ (maybe 2.7.9+ if it gets fixed quick enough). > But it will likely be rejected because the documentation advises against > using ‘__import__’. Functions that should accept str but barf on unicode have a tendency to g

missing os.lchmod, os.lchflags

2014-12-24 Thread Ethan Furman
According to the docs [1] these functions should be available as of 2.6, yet they are missing on a 2.7, 3.2, and 3.4 install (ubuntu 12.10 and 14.04) Any ideas why? -- ~Ethan~ [1] https://docs.python.org/2/library/os.html#os.lchmod -- https://mail.python.org/mailman/listinfo/python-list

Re: missing os.lchmod, os.lchflags

2014-12-24 Thread Ethan Furman
On 12/24/2014 01:23 PM, Chris Angelico wrote: On Thu, Dec 25, 2014 at 7:22 AM, Tim Chase wrote: On 2014-12-24 11:42, Ethan Furman wrote: According to the docs [1] these functions should be available as of 2.6, yet they are missing on a 2.7, 3.2, and 3.4 install (ubuntu 12.10 and 14.04

Re: Comparisons and sorting of a numeric class....

2015-01-07 Thread Ethan Furman
e instance each of those two values (True and False). If bool were subclassable, new values could be added with either completely different values (PartTrue) or with more of the same value (True, ReallyTrue, AbsolutelyTrue) -- hence, broken contract. -- ~Ethan~ signature.asc Description: Open

Re: Is anyone else unable to log into the bug tracker?

2015-01-09 Thread Ethan Furman
hort cut, and with my name/password (not Google). -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: PyWart: Poor Documentation Examples

2015-01-10 Thread Ethan Furman
On 01/10/2015 06:32 PM, Steven D'Aprano wrote: > > If you treat your readers as idiots, only idiots will read your writing. Or the morbidly curious, which I presume covers your case (along with a handful of others ;) . -- ~Ethan~ signature.asc Description: OpenPGP digita

Re: Namespace puzzle, list comprehension fails within class definition

2015-01-12 Thread Ethan Furman
for x in (0,2)] In Foo 'f' is part of an unnamed namespace; the list comp 'g' has its own namespace, effectively making be a nonlocal; class name lookup skips nonlocal namespaces. Workaround: use an actual for loop. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Namespace puzzle, list comprehension fails within class definition

2015-01-12 Thread Ethan Furman
On 01/12/2015 08:49 PM, Steven D'Aprano wrote: > On Mon, 12 Jan 2015 12:40:13 -0800, Ethan Furman wrote: >> >> [...] class name lookup skips nonlocal namespaces. > > Actually, no it doesn't. > [...] > The "problem" is that *functions* lookup don&

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Ethan Furman
On 01/15/2015 09:29 PM, Ian Kelly wrote: > > In Python you just have one initializer with defaults for the optional > arguments, so it's not an issue. What, Python makes it easy? That must be a mistake somewhere! ;) -- ~Ethan~ signature.asc Description: OpenPGP digital signa

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Ethan Furman
ames" as a personal driving factor, but the educational system should still teach decent programming, not whatever piece of garbage will produce quick results at the expense of long-term productivity. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-21 Thread Ethan Furman
pointer to something (but it isn't). > is probably going to have bigger troubles with Python than just type-hinting. Yup, true -- I do find writing meta-classes takes extra work. ;) -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: kivy secret of mana game

2015-01-23 Thread Ethan Furman
On 01/22/2015 09:13 AM, Automn wrote: > > I am programming a "Secret of Mana" (Seiken Densetsu) game in kivy, it runs > on a phone with kivy launcher. AWESOME That was a totally fabulous game -- one of the very few I actually played to the end. :) -- ~Ethan~ signat

Re: Alternative to multi-line lambdas: Assign-anywhere def statements

2015-01-24 Thread Ethan Furman
ass dispatch: def __init__(self, dispatch_table): self.dispatch = dispatch_table def __call__(self, func): self.dispatch[func.__name__] = func return func @dispatch(dispatch_table_a) def foo(...): pass -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Alternative to multi-line lambdas: Assign-anywhere def statements

2015-01-24 Thread Ethan Furman
On 01/24/2015 11:55 AM, Chris Angelico wrote: > On Sun, Jan 25, 2015 at 5:56 AM, Ethan Furman wrote: >> If the non-generic is what you're concerned about: >> >> # not tested >> dispatch_table_a = {} >> dispatch_table_b = {} >> dispatch_table_c = {}

Re: An object is an instance (or not)?

2015-01-27 Thread Ethan Furman
ils on a regular class MyEnum['EnumName'] # fails on a regular class -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: The Most Diabolical Python Antipattern

2015-01-29 Thread Ethan Furman
lling exit(). Yeah, I hate when that happens. I hate it even more when it's my own library. :/ (yeah, I fixed that!) -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: joke

2015-01-29 Thread Ethan Furman
pect it is a reference to an old Eddie Murphy (?) movie in which he is a prince and has attendants to bathe him. If I am correct it is an immature joke and has no place on this list. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT]very high tech humour

2015-01-31 Thread Ethan Furman
LOL! -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-31 Thread Ethan Furman
is called. If __repr__ is missing, object.__repr__ (or some intermediate base class' __repr__) is called. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-01 Thread Ethan Furman
ee if that works - possibly others that I don't recall at the moment Basically, unless you're programming at the system (or class internals) level, don't call dunder methods directly. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: CSV and number formats

2015-02-01 Thread Ethan Furman
t;> >> If the opening balance is positive, it appears as '+0021.45' >> >> If it is negative, it appears as '+0-21.45' 1) I have never seen that format before. 2) Regular transactions (non-opening balance) appear normally. 3) That's a bug! 4) Eas

Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-03 Thread Ethan Furman
hon. Thankfully, it will also never be Python. However, because Python is so awesome, you can twist your own code to behave that way, to a point: simply have your __init__ ( or __new__) populate the instance dict with all non-dunder methods. Or even better, implement your own proto(mumble) t

Re: meaning of: line, =

2015-02-04 Thread Ethan Furman
than unpacking; By unpacking you are also double checking that the returned iterable contains exactly one item; more or less will cause an exception -- you only get half that check if you index. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Setuptools, __init__ and __main__

2015-02-06 Thread Ethan Furman
your code in __main__.py and have an empty __init__.py. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Setuptools, __init__ and __main__

2015-02-06 Thread Ethan Furman
mand into a file was going to be easy, then so would be writing it to __main__.py instead? -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Incompatible idioms: relative imports, top-level program file

2015-02-06 Thread Ethan Furman
On 02/06/2015 04:44 PM, Ben Finney wrote: > Ethan Furman writes: > >> On 02/06/2015 02:56 PM, Ben Finney wrote: >>> It is a deliberate design decision that direct import of a module >>> makes that module blind to its location in the package hierarchy. >>>

Re: What killed Smalltalk could kill Python

2015-02-09 Thread Ethan Furman
joyable, thank you! -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: TypeError: list indices must be integers, not tuple

2015-02-09 Thread Ethan Furman
es must be integers, not tuple > > How do I set a variable to a random number then use it as a list indece, (I'm > only a student in his first 6 months of using python) When you say Menu[fav,RandomNum] the `fav,RandomNum` portion is a tuple. `fav` should be 1 or 2 or 3, not "1" nor "2" nor "3". `RandomNum` should be be `random.randint(0,2)` Finally: submenu = Menu[fav] random_food = submenu[RandomNum] -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: __next__ and StopIteration

2015-02-10 Thread Ethan Furman
with a grid of 4x5 with 7 blank cells you get 13 iterations -- probably not what was expected. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: __next__ and StopIteration

2015-02-10 Thread Ethan Furman
On 02/10/2015 08:53 AM, Ian Kelly wrote: > On Tue, Feb 10, 2015 at 9:44 AM, Ethan Furman wrote: >> On 02/09/2015 08:46 PM, Chris Angelico wrote: >>> >>> class Grid: >>> blah blah >>> >>> def __iter__(self): >>> for

Re: Wildly OT: pop-up virtual keyboard for Mac or Linux?

2015-02-10 Thread Ethan Furman
dow type thingie [1]. -- ~Ethan~ [1] Yes, that's the technical name for it ;) okay, okay, not really. signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: line_profiler: what am I doing wrong?

2015-02-10 Thread Ethan Furman
'profile' is not defined I'm going to guess that writing the profile results is in a try/finally -- so first you see the results being written, then the exception that triggered. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Alternative to multi-line lambdas: Assign-anywhere def statements

2015-02-11 Thread Ethan Furman
e twenty-sixth one with a peer... are you going to say, "Hey, look at the twenty-sixth one -- I think it has a bug." or something more like, "Hey, I think there's a bug in the hyp sin function." ? People use names, names are good. Python uses names, because names are good. -

Re: Python discussed in Nature

2015-02-12 Thread Ethan Furman
ry nice article, thanks for sharing! -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Python implementations in JavaScript

2015-02-14 Thread Ethan Furman
ears old now. I remember a post from a few weeks ago that said Brython had worked just fine for their needs. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: line_profiler: what am I doing wrong?

2015-02-16 Thread Ethan Furman
x27; directly would be the workaround. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: What the Pythons docs means by "container" ?

2015-02-18 Thread Ethan Furman
with those objects. Whether a "contained" object exists before it is accessed is irrelevant, is an implementation detail, and is a level of optimization. -- ~Ethan~ signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

<    5   6   7   8   9   10   11   12   13   14   >