Re: gotta love radio buttons

2014-01-05 Thread Ned Batchelder
loop (r in this case) takes on the values of the elements of the list, not the indexes of the elements. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: converting a string to a function parameter

2014-01-05 Thread Ned Batchelder
65] def function(m): m2 = m m3 = m[:] takethenameof(m) takethenameof(m2) takethenameof(m3) takethenameof(m[:]) takethenameof(2) takethenameof(2+2) There are samples online that try to do a "reasonable" job of this, but

Re: "More About Unicode in Python 2 and 3"

2014-01-05 Thread Ned Batchelder
On 1/5/14 8:22 AM, Ned Batchelder wrote: On 1/5/14 8:14 AM, Mark Lawrence wrote: http://lucumr.pocoo.org/2014/1/5/unicode-in-2-and-3/ Please don't shoot the messenger :) With all of the talk about py 2 vs. py3 these days, this is the blog post that I think deserves the most real atte

Re: "More About Unicode in Python 2 and 3"

2014-01-05 Thread Ned Batchelder
On 1/5/14 8:48 PM, Chris Angelico wrote: On Mon, Jan 6, 2014 at 12:16 PM, Ned Batchelder wrote: So now we have two revered developers vocally having trouble with Python 3. You can dismiss their concerns as niche because it's only network programming, but that would be a mistake. IMO, ne

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Ned Batchelder
On 1/5/14 11:26 PM, Terry Reedy wrote: On 1/5/2014 8:16 PM, Ned Batchelder wrote: OK, let's see what we got from three core developers on this list: To me, the following is a partly unfair summary. I apologize, I'm sure there were details I skipped in my short summary.

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Ned Batchelder
oded bytes as text is the problem here. I think the whole forking community is confused at because of your own arrogance. Foo(l)s. markj If you want to participate in this discussion, do so. Calling people strange, arrogant, and fools with no technical content is just rude. Typing "YO

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Ned Batchelder
On 1/6/14 12:50 PM, Steven D'Aprano wrote: Ned Batchelder wrote: You are still talking about whether Armin is right, and whether he writes well, about flaws in his statistics, etc. I'm talking about the fact that an organization (Python core development) has a product (Python

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Ned Batchelder
On 1/6/14 11:29 AM, Antoine Pitrou wrote: Ned Batchelder nedbatchelder.com> writes: You can look through his problems and decide that he's "wrong," or that he's "ranting," but that doesn't change the fact that Python 3 is encountering friction. What

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Ned Batchelder
'm not going to tell you why" approach. Please stop baiting people. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Ned Batchelder
On 1/6/14 5:08 PM, Mark Lawrence wrote: On 06/01/2014 21:42, Ned Batchelder wrote: On 1/6/14 4:33 PM, Mark Lawrence wrote: On 06/01/2014 21:17, Gene Heskett wrote: On Monday 06 January 2014 16:16:13 Terry Reedy did opine: On 1/6/2014 9:32 AM, Gene Heskett wrote: And from my lurking here

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Ned Batchelder
On 1/6/14 5:16 PM, Antoine Pitrou wrote: Ned Batchelder nedbatchelder.com> writes: I never said they were the whole community, of course. But they are not outliers either. By your own statistics above, 23% of respondents think Python 3 was a mistake. Armin and Kenneth are just two v

Re: "More About Unicode in Python 2 and 3"

2014-01-07 Thread Ned Batchelder
On 1/6/14 5:30 PM, Mark Lawrence wrote: On 06/01/2014 22:22, Ned Batchelder wrote: On 1/6/14 5:08 PM, Mark Lawrence wrote: On 06/01/2014 21:42, Ned Batchelder wrote: On 1/6/14 4:33 PM, Mark Lawrence wrote: That strikes me as being as useful as "The PEP 393 FSR is completely wrong but I&

Re: "More About Unicode in Python 2 and 3"

2014-01-07 Thread Ned Batchelder
On 1/6/14 11:01 PM, Steven D'Aprano wrote: On Mon, 06 Jan 2014 16:32:01 -0500, Ned Batchelder wrote: On 1/6/14 12:50 PM, Steven D'Aprano wrote: Ned Batchelder wrote: You are still talking about whether Armin is right, and whether he writes well, about flaws in his statistics,

Re: Bytes indexing returns an int

2014-01-08 Thread Ned Batchelder
0.3803570633857589 timeit.timeit("len(unicodedata.normalize('NFKD', 'ǟ'))", "import unicodedata") 0.9359970320201683 pdf, typography, linguistic, scripts, ... in mind, in other word the real *unicode* world. jmf -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2.x and 3.x usage survey

2014-01-10 Thread Ned Batchelder
When we forget, there can be bugs. I'm sure that I'll get used to it eventually. On Python-Dev, Dan Stromberg posted this link with the results: http://stromberg.dnsalias.org/~strombrg/python-2.x-vs-3.x-survey/ -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Input Error issues - Windows 7

2014-01-10 Thread Ned Batchelder
? The PYTHONPATH contains the directories that will be searched for modules and packages. Your package is called foo, and is in c:\workspace\PyFoo\src. That directory is not on the Python path, and it isn't the current directory. Therefore, your package can't be found and i

Re: Python 2.x and 3.x usage survey

2014-01-10 Thread Ned Batchelder
On 1/10/14 2:43 PM, John Ladasky wrote: On Friday, January 10, 2014 9:48:43 AM UTC-8, Ned Batchelder wrote: On Python-Dev, Dan Stromberg posted this link with the results: http://stromberg.dnsalias.org/~strombrg/python-2.x-vs-3.x-survey/ That link gave me a 404. :^( Sorry, it worked

Re: L[:]

2014-01-10 Thread Ned Batchelder
onfusing. Here's an explanation of the mechanics: http://nedbatchelder.com/text/names.html HTH, --Ned. Thanks! Regards, Albert-Jan -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it better to import python modules inside function or at the top? What are the pros and cons?

2014-01-11 Thread Ned Batchelder
unction is called. After the first import, the cost is about the same as a dict lookup (very fast). -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: 'Straße' ('Strasse') and Python 2

2014-01-12 Thread Ned Batchelder
ke a point, you have to put some English around it. You know what is in your head, but we do not. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: What's correct Python syntax?

2014-01-14 Thread Ned Batchelder
n this example, but if you have more than one value being formatted, this (and the "{0.foo}" syntax) can make digging into nested data more convenient. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Chanelling Guido - dict subclasses

2014-01-14 Thread Ned Batchelder
getting at, I suspect he was talking at a more refined "principles of object design" level rather than "dicts don't happen to work that way" level. Also, I've never done it, but I understand that deriving from collections.MutableMapping avoids this problem. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: 'Straße' ('Strasse') and Python 2

2014-01-15 Thread Ned Batchelder
s up a grapheme, and that you'll need code to deal with the correspondence between them. But let's not muddy these already confusing waters by referring to that mapping as an encoding. In Unicode terms, an encoding is a mapping between codepoints and bytes. Python 3'

Re: Question about object lifetime and access

2014-01-15 Thread Ned Batchelder
are. The value assigned to p can be reclaimed if you reassign the name p, and nothing else is referring to the value. The rationale behind these question is to avoid object creation within application() whose content is same and do not change between requests calling application() function

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Ned Batchelder
dis module for disassembling it. How to protect your code depends an awful lot on what kinds of secrets are in the code, and how valuable those secrets are, and therefore how hard someone will work to get at them. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailma

Re: Compiling main script into .pyc

2014-01-16 Thread Ned Batchelder
. The standard library has the compileall module that can be used to create .pyc files from .py files, but as we've been discussing in another thread, you may not want .pyc files. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: SIngleton from __defaults__

2014-01-22 Thread Ned Batchelder
ssing mess i ended up using sqlite access to DB in exclusive transaction mode. But this was not pythonic :-) Asaf -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Can post a code but afraid of plagiarism

2014-01-22 Thread Ned Batchelder
made the design for whole code. Just stuck at this part You should collect all your thoughts and write one message, not six in 30 minutes. That's just pestering. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: should I transfer 'iterators' between functions?

2014-01-25 Thread Ned Batchelder
hing. This is covered in more detail here: http://nedbatchelder.com/text/names.html -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: should I transfer 'iterators' between functions?

2014-01-25 Thread Ned Batchelder
l = [1, 2, 3, 4, 5, 6, 7, 8] return l def main(): for i in test(): print(i) -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Highlighting program variables instead of keywords?

2014-01-28 Thread Ned Batchelder
try to convince someone, convince me. Write to me offline: n...@nedbatchelder.com -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Why this throws an UnboundLocalError ?

2014-01-30 Thread Ned Batchelder
ocal variable 'GLOBAL' referenced before assignment And I don't know why :( Anyone ? Thanks!! Assignment statements in functions implicitly make local names. If you want to assign a new value to a global name in a function, you have to use a global statement: def update()

Re: __init__ is the initialiser

2014-01-31 Thread Ned Batchelder
antics of the word "constructor" any more than we have to tied to its semantics of the word "variable" or "for". Why can't we call __init__ the constructor and __new__ the allocator? -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: __init__ is the initialiser

2014-01-31 Thread Ned Batchelder
On 1/31/14 3:57 PM, Ethan Furman wrote: 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 cal

Re: __init__ is the initialiser

2014-01-31 Thread Ned Batchelder
On 1/31/14 6:05 PM, Ben Finney wrote: Ned Batchelder writes: On 1/31/14 2:33 PM, Mark Lawrence wrote: From http://docs.python.org/3/reference/datamodel.html#object.__init__ […] Should the wording of the above be changed to clearly reflect that we have an initialiser here and that __new__

Re: __init__ is the initialiser

2014-01-31 Thread Ned Batchelder
derstood) that most user-defined classes define __init__, and that very very few define __new__. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: __init__ is the initialiser

2014-02-01 Thread Ned Batchelder
On 1/31/14 10:42 PM, Steven D'Aprano wrote: On Fri, 31 Jan 2014 14:52:15 -0500, Ned Batchelder wrote: Why can't we call __init__ the constructor and __new__ the allocator? __new__ constructs the object, and __init__ initialises it. What's wrong with calling them the

Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-04 Thread Ned Batchelder
use this technique, it is not particular to the Python docs. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Concepts and Applications of Finite Element Analysis (4th Ed., Cook, Malkus, Plesha & Witt)

2014-02-04 Thread Ned Batchelder
manuals, this kind of response is completely unacceptable. Please don't do it again. Please read this: http://www.python.org/psf/codeofconduct -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-05 Thread Ned Batchelder
than about my (jmf) software. (*) Luckily, that's already the case for the users using serious tools. We've been over this too many times already, and we won't be discussing it with you again. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Finding size of Variable

2014-02-06 Thread Ned Batchelder
27;a EURO', 'aa EURO']*3]) 261 sum([sys.getsizeof(c.encode('utf-32')) for c in ['aa EURO aa EURO']*3]) 135 jmf JMF, we've told you I-don't-know-how-many-times to stop this. Seriously: think hard about what your purpose is in sending thes

Re: Python3, __slots__ and serialization

2014-02-08 Thread Ned Batchelder
utes dictionary. Why do you need to prevent attribute creation? If someone uses your class and wants to use it in ways you didn't anticipate, why should you try to stop them? -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Python3, __slots__ and serialization

2014-02-08 Thread Ned Batchelder
On 2/8/14 1:29 PM, Ned Batchelder wrote: On 2/8/14 1:06 PM, Eric Jacoboni wrote: Hi, Say i want create a class with a __slots__ tuple in order to prevent creation of new attributes from outside the class. Say i want to serialize instances of this class... With pickle, all is ok : i can dump

Re: Finding size of Variable

2014-02-08 Thread Ned Batchelder
https://mail.python.org/mailman/listinfo/python-list -- Best Regards, David Hutto /*CEO:*/ _http://www.hitwebdevelopment.com_ -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Finding size of Variable

2014-02-08 Thread Ned Batchelder
In my book this classic trolling." I don't think he was, I think he was referring to JMF. In any case, perhaps it would be best to just take a break? -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Finding size of Variable

2014-02-10 Thread Ned Batchelder
ndexing while saving space when a string doesn't need to use a full 32-bit width. -tkc Please don't engage in this debate with JMF. His mind is made up, and he will not be swayed, no matter how persuasive and reasonable your arguments. Just ignore him. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Pylint across Python versions

2014-02-10 Thread Ned Batchelder
ut also, you might find it easier to use the "six" module from PyPI to handle these sorts of differences. It's easier than doing it ad-hoc with your own logic. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)

2014-02-10 Thread Ned Batchelder
need "foo().something" ? In what cases does the word foo invoke the function, and when doesn't it? It's not possible to make a programming language error-proof. There will always be mistakes programmers can make. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)

2014-02-10 Thread Ned Batchelder
class) map(myfunc, range(10)) x = property(x_get, x_set) would still work? I guess neither would: except ValueError: :( -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: What is a function parameter =[] for?

2015-11-24 Thread Ned Batchelder
On Tuesday, November 24, 2015 at 9:34:36 AM UTC-5, Antoon Pardon wrote: > Op 20-11-15 om 13:12 schreef Ned Batchelder: > > On Friday, November 20, 2015 at 6:59:54 AM UTC-5, BartC wrote: > >> On 20/11/2015 01:05, Steven D'Aprano wrote: > >>> On Fri

Re: What is a function parameter =[] for?

2015-11-24 Thread Ned Batchelder
On Tuesday, November 24, 2015 at 10:10:51 AM UTC-5, Antoon Pardon wrote: > Op 24-11-15 om 15:18 schreef Ned Batchelder: > > > 2) In Python, "value" means, what object does a name refer to, or what > > object did an evaluation produce. > > I don't think t

Re: Returning a result from 3 items in a list

2015-11-24 Thread Ned Batchelder
On Tuesday, November 24, 2015 at 9:29:30 AM UTC-5, Mark Lawrence wrote: > On 24/11/2015 14:07, Denis McMahon wrote: > > On Tue, 24 Nov 2015 02:04:56 -0800, Cai Gengyang wrote: > > > >> Here's a dictionary with 3 values : > >> > >> results = { > >>"gengyang": 14, > >>"ensheng": 13, "jordan":

Re: What is a function parameter =[] for?

2015-11-24 Thread Ned Batchelder
On Tuesday, November 24, 2015 at 12:25:54 PM UTC-5, Oscar Benjamin wrote: > On 24 November 2015 at 15:27, Ned Batchelder wrote: > > On Tuesday, November 24, 2015 at 10:10:51 AM UTC-5, Antoon Pardon wrote: > >> Op 24-11-15 om 15:18 schreef Ned Batchelder: > >> > &g

Re: What is a function parameter =[] for?

2015-11-24 Thread Ned Batchelder
On Tuesday, November 24, 2015 at 1:45:34 PM UTC-5, Antoon Pardon wrote: > Whether you want to call it literals or something else, the fact > remains that (3, 5, 8) is treated like -42 by the CPython interpreter > and [3, 5, 8] is not. Maybe I've lost the original point in all this minutia about wh

Re: Late-binding of function defaults (was Re: What is a function parameter =[] for?)

2015-11-25 Thread Ned Batchelder
On Wednesday, November 25, 2015 at 8:20:59 AM UTC-5, BartC wrote: > Accept that some things /are/ a source of confusion. When, in writing > documentation, I find something hard to explain something, then I try > and make it simpler in the program. But not enough of that goes on: it > seems to be

Re: Late-binding of function defaults (was Re: What is a function parameter =[] for?)

2015-11-25 Thread Ned Batchelder
On Wednesday, November 25, 2015 at 8:23:36 PM UTC-5, BartC wrote: > On 26/11/2015 00:31, Steven D'Aprano wrote: > > On Thu, 26 Nov 2015 09:41 am, BartC wrote: > > > >> Maybe you're too familiar with it. But the idea of executing the > >> function and other definitions in a file, instead of they jus

Why is break allowed in finally, but continue is not?

2015-12-13 Thread Ned Batchelder
For testing coverage.py, I wrote a program to generate randomly-structured Python functions. When compiling the results, I got a message I'd never seen before: SyntaxError: 'continue' not supported inside 'finally' clause I guess this makes sense, when cleaning up from an exception, continuing t

Re: Why is break allowed in finally, but continue is not?

2015-12-14 Thread Ned Batchelder
On Sunday, December 13, 2015 at 5:28:44 PM UTC-5, Ben Finney wrote: > Ned Batchelder writes: > > So why treat 'continue' specially? > > I am inclined to agree, but in the opposite direction: a case should be > made for allowing *any* flow-control statement in an ex

Re: monkey patching __code__

2016-03-19 Thread Ned Batchelder
On Friday, March 18, 2016 at 10:33:46 AM UTC-4, Sven R. Kunze wrote: > On 18.03.2016 15:23, Ian Kelly wrote: > > On Fri, Mar 18, 2016 at 7:47 AM, Ian Kelly wrote: > >> Your patched version takes two extra arguments. Did you add the > >> defaults for those to the function's __defaults__ attribute?

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Ned Batchelder
On Sunday, March 20, 2016 at 9:15:32 PM UTC-4, BartC wrote: > > A tokeniser along those lines in Python, with most of the bits filled > in, is here: > > http://pastebin.com/dtM8WnFZ > Bart, we get it: you don't like the trade-offs that Python has made. You want Python to be faster, but it can'

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Ned Batchelder
On Monday, March 21, 2016 at 8:44:01 AM UTC-4, BartC wrote: > On 21/03/2016 12:08, Ned Batchelder wrote: > > On Sunday, March 20, 2016 at 9:15:32 PM UTC-4, BartC wrote: > >> > >> A tokeniser along those lines in Python, with most of the bits filled > >> in, is

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Ned Batchelder
On Monday, March 21, 2016 at 3:43:40 PM UTC-4, BartC wrote: > > This code was adapted from a program that used: > > readstrfile(filename) > > which either returned the contents of the file as a string, or 0. > > That's all. My Python version was thrown together as I don't know if > there's

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-22 Thread Ned Batchelder
On Tuesday, March 22, 2016 at 7:05:20 AM UTC-4, BartC wrote: > On 22/03/2016 01:01, Steven D'Aprano wrote: > > Pythonic code probably uses a lot of iterables: > > > > for value in something: > > ... > > > in preference to Pascal code written in Python: > > > > for index in range(len(something

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-22 Thread Ned Batchelder
On Tuesday, March 22, 2016 at 10:02:41 AM UTC-4, BartC wrote: > On 22/03/2016 13:13, Chris Angelico wrote: > > On Tue, Mar 22, 2016 at 11:59 PM, BartC wrote: > > > The first step in any program is to write it in the very simplest way > > possible. That usually means ignoring all error handling. A

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-23 Thread Ned Batchelder
On Wednesday, March 23, 2016 at 6:35:12 AM UTC-4, BartC wrote: > On 23/03/2016 06:09, Ben Finney wrote: > > > The problem is that Bart simultaneously is a beginner at Python, and > > expresses astonishment that everyone shrugs when Bart's > > dreadfully-written code performs so badly. > > My inte

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Ned Batchelder
On Thursday, March 24, 2016 at 9:51:11 AM UTC-4, Steven D'Aprano wrote: > You know what is missing from this conversation? > > For one of Bart's critics to actually show faster code. > > There's plenty of people telling him off for writing unpythonic and slow > code, but I haven't seen anyone act

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Ned Batchelder
On Thursday, March 24, 2016 at 12:12:55 PM UTC-4, BartC wrote: > On 24/03/2016 15:30, Ned Batchelder wrote: > > On Thursday, March 24, 2016 at 9:51:11 AM UTC-4, Steven D'Aprano wrote: > >> You know what is missing from this conversation? > >> > >> For one

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Ned Batchelder
On Thursday, March 24, 2016 at 2:03:58 PM UTC-4, BartC wrote: > On 24/03/2016 17:13, Ned Batchelder wrote: > > On Thursday, March 24, 2016 at 12:12:55 PM UTC-4, BartC wrote: > >> On 24/03/2016 15:30, Ned Batchelder wrote: > >>> On Thursday, March 24, 2016 at 9:51:11 A

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Ned Batchelder
On Thursday, March 24, 2016 at 7:47:34 PM UTC-4, Mark Lawrence wrote: > On 24/03/2016 23:33, Ian Kelly wrote: > > On Thu, Mar 24, 2016 at 4:58 PM, Mark Lawrence > > wrote: > >> No. While this idiot, BartC, is let loose on this forum, I'll say what I > >> like. > > > > Good to know. I've been on

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-25 Thread Ned Batchelder
On Friday, March 25, 2016 at 5:17:21 PM UTC-4, Thomas 'PointedEars' Lahn wrote: > c...@isbd.net wrote: > > > Occasionally I have to make forays into Javascript, can anyone > > recommend a place similar to this list where Javascript questions can > > be asked? The trouble is that there are very ma

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-26 Thread Ned Batchelder
On Friday, March 25, 2016 at 11:37:34 PM UTC-4, Thomas 'PointedEars' Lahn wrote: > Chris Angelico wrote: > > > On Sat, Mar 26, 2016 at 12:36 PM, Thomas 'PointedEars' Lahn > > wrote: > >>> Thomas is not typical of the Python community. We are mostly nice > >>> people. > >>> :) > >> > >> You do not

Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Ned Batchelder
On Saturday, March 26, 2016 at 5:59:30 AM UTC-4, Juan Dent wrote: > I am trying to run 'python cppdep.py' but get the following: > > > analyzing dependencies among all components ... > Traceback (most recent call last

Re: Why lambda in loop requires default?

2016-03-27 Thread Ned Batchelder
On Sunday, March 27, 2016 at 9:55:16 AM UTC-4, g vim wrote: > Given that Python, like Ruby, is an object-oriented language It turns out that "object-oriented" means very little, and lots of languages that are object-oriented will behave differently from each other, even where object behavior is c

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Ned Batchelder
On Sunday, March 27, 2016 at 10:43:49 AM UTC-4, BartC wrote: > On 27/03/2016 14:47, Dennis Lee Bieber wrote: > > On Sun, 27 Mar 2016 12:31:26 +0100, BartC declaimed the > > following: > > > >> On 27/03/2016 07:34, Paul Rubin wrote: > >>> BartC writes: > But my suggestion was to have requi

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Ned Batchelder
On Sunday, March 27, 2016 at 12:58:23 PM UTC-4, BartC wrote: > On 27/03/2016 16:48, Ned Batchelder wrote: > > On Sunday, March 27, 2016 at 10:43:49 AM UTC-4, BartC wrote: > >> On 27/03/2016 14:47, Dennis Lee Bieber wrote: > > >> Well, that could be done in Pytho

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Ned Batchelder
On Sunday, March 27, 2016 at 4:19:12 PM UTC-4, BartC wrote: > On 27/03/2016 18:19, Ned Batchelder wrote: > > On Sunday, March 27, 2016 at 12:58:23 PM UTC-4, BartC wrote: > > >> There would be a list of expression terms that can also form independent > >> statements

Re: (test) ? a:b

2014-10-22 Thread Ned Batchelder
On 10/22/14 12:28 PM, Steven D'Aprano wrote: Ned Batchelder wrote: On 10/22/14 5:05 AM, busca...@gmail.com wrote: without not: j = [j+1, 3][j>=10] with not: j = [3, j+1][not (j>=10)] Why on earth would you recommend this outdated hack, when there's a true conditional op

Re: (test) ? a:b

2014-10-25 Thread Ned Batchelder
and False == 0. You mention "standard Python idioms." I think this style of conditional-via-indexing is becoming quite uncommon, and is no longer one of the standard Python idioms. This is now in the category of "outdated hack." Yes, its meaning is well-defined by the

Re: (-1)**1000

2014-10-26 Thread Ned Batchelder
et from it. Benefit in this case would have to include a guess as to how often real programs would hit the optimization case. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: variable attribute name

2014-10-27 Thread Ned Batchelder
the first place: a = {} a[s] = 1 -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: %%(%s)s mean in python

2014-10-29 Thread Ned Batchelder
pends entirely on context. You'll need to find a *small* example of what you are asking about so we can help. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: __index__

2014-11-01 Thread Ned Batchelder
g an MD5 hash, you use the md5.hexdigest() method, not hex(md5). -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Installing Parsers/Tree Builders to, and accessing these packages from Python2.7

2014-11-02 Thread Ned Batchelder
#x27;d be surprised the kinds of clues that lurk there. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle.

2014-11-08 Thread Ned Batchelder
on the "def" token, not the "def" in "get_default". .rindex isn't what you want in any case. Use .index in both cases. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: What is \1 here?

2014-11-11 Thread Ned Batchelder
d this stuff out for yourself. Ben Finney even gave you a pointer to a helpful site for experimenting with regexes: http://pythex.org/ -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: How to get file descriptors of sys.stdin, sys.stdout and sys.stderr?

2014-11-13 Thread Ned Batchelder
. You are misbehaving on this list. Everyone else: I recommend that people stop responding. Satish seems unlikely to improve. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: encode and decode builtins

2014-11-16 Thread Ned Batchelder
ould accomplish two goals: explicitly stating what I expect of my data, and doing so concisely and cleanly. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Using map()

2014-11-16 Thread Ned Batchelder
or ** magic "magic"? They're features of the language! Meanwhile, it doesn't mind if you write multiply-inherited metaclasses -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Messages from code analysis tools

2014-11-16 Thread Ned Batchelder
On 11/16/14 8:21 PM, Ben Finney wrote: Ned Batchelder writes: Pylint isn't useful until you've tailored the messages. Definitely agreed. The pylint message that always irked me was: W0142: Used * or ** magic "magic"? They're features of the language! It

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-21 Thread Ned Batchelder
messages, with less bombast. I don't know if you are aiming for humor with your messages, but to my ears, you are verging on self-parody. I'm surprised that people are taking you seriously. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Using Python for date calculations

2014-11-21 Thread Ned Batchelder
On 11/21/14 9:55 AM, Steven D'Aprano wrote: - Use your OS facilities to run that process in a chroot jail. If you are interested, this is the facility that edX uses to run untrusted Python code on the servers: https://github.com/edx/codejail -- Ned Batchelder, http://nedbatchelde

Re: I have no class

2014-11-22 Thread Ned Batchelder
t). Once you make an object from it, you will have what you want: class RPS(object): def __init__(self): self.throw = random.randrange(3) a = RPS() b = RPS() print a.throw print b.throw -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.

Re: unloading a module created with imp.new_module

2014-11-23 Thread Ned Batchelder
, so where is the dangling reference? Thanks! This sounds tricky, and possible very difficult to do properly. Do you mind if I ask what the larger problem is? Python might not be very good at having modules come and go as you want. -- Ned Batchelder, http://nedbatchelder.com -- https

Re: unloading a module created with imp.new_module

2014-11-24 Thread Ned Batchelder
iate the class to create objects, then even when you reload updated code, the old objects will still refer to the old classes. This is one of the things that makes reloading modules in Python so difficult. On Nov 23, 2014, at 5:56 PM, Ned Batchelder mailto:n...@nedbatchelder.com>>

Re: unloading a module created with imp.new_module

2014-11-24 Thread Ned Batchelder
and “done”. This is not being run from the interactive interpreter by via a .py file. Let's look at this another way: Why do you need the module to be unloaded? Isn't it enough to have the new code loaded? -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-24 Thread Ned Batchelder
On 11/24/14 11:51 AM, Rick Johnson wrote: ... lots of off-topic ranting ... Everyone: as tempting as it is to respond, the best course of action will be to completely ignore Rick's rants. Thanks, -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/lis

Re: [ANN] Pylint 1.4 released

2014-11-27 Thread Ned Batchelder
to open a new issue on our issue tracker. I found a problem with the new spell feature, but the issue tracker (http://www.bytebucket.org/logilab/pylint/issues) seems broken: everything I tried ended at a 403 CSRF validation failure page. Is there another way to report problems? -- Ned Bat

Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Ned Batchelder
eresting_lines a pure filter, and doesn't care what sort of sequence of strings it's operating on. This makes it easier to test, and more flexible. The caller's code is also clearer in my opinion. BTW: this example is taken verbatim from my PyCon presentation on iteration, it you a

Re: Cherrypy - prevent browser "prefetch"?

2014-12-01 Thread Ned Batchelder
uldn't pre-fetch a URL is to make it a POST request. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: PyEval_GetLocals and unreferenced variables

2014-12-02 Thread Ned Batchelder
ut that sort of defeats the purpose. I would use thread locals for this: https://docs.python.org/2/library/threading.html#threading.local They act like global variables, in that they are available implicitly without being passed around, but like locals in that two separate threads will have di

<    1   2   3   4   5   6   7   8   9   >