Re: Apache restart after source changes

2013-12-26 Thread Ned Batchelder
. I don't know what the options are for auto-restarting the kinds of web servers you'd use in production, I'm sure there are some. Someone here mentioned the Django web server, but that isn't intended for production use. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org

Re: unicode to human readable format

2013-12-27 Thread Ned Batchelder
with the fundamentals, you can read or watch this PyCon presentation: Pragmatic Unicode, or, How Do I Stop the Pain? http://nedbatchelder.com/text/unipain.html -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-27 Thread Ned Batchelder
with the differences. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Ned Batchelder
2013-12-27 12:07:381388164058.73 2013-12-27 12:07:381388164058.92 Thanks! Instead of: %s % time.time() try: %.6f % time.time() %.6f is a formatting code meaning, floating-point number, 6 decimal places. -- Ned Batchelder, http://nedbatchelder.com -- https

Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Ned Batchelder
! Repeatedly people have asked you to show your exact code. Still nothing. Is something wrong with the connectivity of this list? Matt posted his code about six hours before your message. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Unit tests and coverage

2013-12-29 Thread Ned Batchelder
with simple function calls. Those tests will be easy to measure with coverage.py, and by the way, they'll run much faster and be easier to debug. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: need to print seconds from the epoch including the millisecond

2013-12-30 Thread Ned Batchelder
() 1388407716.377 print %.4f % time.time() 1388407726.1001 BTW, I said something very similar in this thread 2.5 days ago: https://mail.python.org/pipermail/python-list/2013-December/663454.html I get the feeling not all messages are flowing to all places. -- Ned Batchelder, http

Re: need to print seconds from the epoch including the millisecond

2013-12-30 Thread Ned Batchelder
On 12/30/13 7:50 AM, Ned Batchelder wrote: BTW, I said something very similar in this thread 2.5 days ago: https://mail.python.org/pipermail/python-list/2013-December/663454.html I get the feeling not all messages are flowing to all places. Oops, and now Matt's reply to that message has just

Re: What does --no-skip do in nose?

2013-12-31 Thread Ned Batchelder
/test_foo.py, line 8, in test_fail assert 0 AssertionError -- Ran 3 tests in 0.003s FAILED (failures=1) -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: About some problem

2014-01-02 Thread Ned Batchelder
at installing a Python 2 package. Then you won't find out until you try to run the package that it is incompatible. A mechanism to prevent this seems like a good idea, but since it wasn't in place at the dawn of Python 3, it would be difficult to put in place now. -- Ned Batchelder, http

Re: Blog about python 3

2014-01-04 Thread Ned Batchelder
posts except that my mind's already in a rather broken state, as a combination of programming and Alice in Wonderland. ChrisA I really wish we could discuss these things without baiting trolls. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: More About Unicode in Python 2 and 3

2014-01-05 Thread Ned Batchelder
devs why they should change things to improve this situation. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Blog about python 3

2014-01-05 Thread Ned Batchelder
the possibility that you are wrong. I know I would be glad to learn details of Unicode that I have missed, but so far you haven't provided any. --Ned. I will not refrain you to waste your time in adjusting bytes, if the problem is not on that side. jmf -- Ned Batchelder, http://nedbatchelder.com

Re: gotta love radio buttons

2014-01-05 Thread Ned Batchelder
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
= 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 my googling isn't turning them up... -- Ned

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 attention

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 n...@nedbatchelder.com 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

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. - Antoine

Re: More About Unicode in Python 2 and 3

2014-01-06 Thread Ned Batchelder
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 YOU WOULD BE WRONG in all caps doesn't count as technical content. -- Ned Batchelder, http

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 3

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 ned at 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 happens when a significant fraction

Re: More About Unicode in Python 2 and 3

2014-01-06 Thread Ned Batchelder
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 ned at 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 very

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'm

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, etc. I'm

Re: Bytes indexing returns an int

2014-01-08 Thread Ned Batchelder
(unicodedata.normalize('NFKD', 'zzz')), import unicodedata) 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

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

2014-01-10 Thread Ned Batchelder
. 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
, and it isn't the current directory. Therefore, your package can't be found and imported. BTW: writting getters like getName and getNumber is unusual in Python. The much more common technique is to simply use the attribute: f.name -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org

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
] L2 = L L[:] = [] print L2 [] L = [1, 2, 3, 4] L2 = L L = [] print L2 [1, 2, 3, 4] Names and values in Python can be confusing. Here's an explanation of the mechanics: http://nedbatchelder.com/text/names.html HTH, --Ned. Thanks! Regards, Albert-Jan -- Ned Batchelder, http

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
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
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
directly: items = [alpha, beta, gamma, delta] print {0[1]} {0[3]} {0[0]}.format(items) beta delta alpha It's clunkier in 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

Re: Chanelling Guido - dict subclasses

2014-01-14 Thread Ned Batchelder
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
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's str is a sequence of codepoints. -- Ned Batchelder, http://nedbatchelder.com -- https

Re: Question about object lifetime and access

2014-01-15 Thread Ned Batchelder
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 and thus to reduce script response time. Thanks in advance! Welcome. -- Ned Batchelder, http

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

2014-01-16 Thread Ned Batchelder
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/mailman/listinfo

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
multiprocessing 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
. 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
, 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
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
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(): global GLOBAL GLOBAL += 1 -- Ned Batchelder, http://nedbatchelder.com

Re: __init__ is the initialiser

2014-01-31 Thread Ned Batchelder
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 called __init__. Hm, yes

Re: __init__ is the initialiser

2014-01-31 Thread Ned Batchelder
On 1/31/14 6:05 PM, Ben Finney wrote: Ned Batchelder n...@nedbatchelder.com 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

Re: __init__ is the initialiser

2014-01-31 Thread Ned Batchelder
. I meant (as many have understood) 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 constructor

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

2014-02-04 Thread Ned Batchelder
, 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
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
-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 these absurd benchmarks. I guarantee you are not accomplishing it. -- Ned Batchelder, http://nedbatchelder.com

Re: Python3, __slots__ and serialization

2014-02-08 Thread Ned Batchelder
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
-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
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
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
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
. 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
) 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: Working with the set of real numbers

2014-02-12 Thread Ned Batchelder
On 2/12/14 5:55 AM, wxjmfa...@gmail.com wrote: The fascinating aspect of this FSR lies in its mathematical absurdity. jmf Stop. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: singleton ... again

2014-02-12 Thread Ned Batchelder
the same instance over and over. It makes them impossible to test: your unit tests all act on the same object, there's no way to start over with a fresh object. If you only want one object, create just one, and use it everywhere. -- Ned Batchelder, http://nedbatchelder.com -- https

Re: singleton ... again

2014-02-13 Thread Ned Batchelder
, and will hold onto that object for the next time it's needed. But that's different than a class which pretends to make instances but actually always returns the same instance. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: A curious bit of code...

2014-02-13 Thread Ned Batchelder
from the trouble!) Last but not least... s[::len(s)-1] omg!!? ;-D If you aren't worried about performance, why are you choosing your code based on which is the fastest? There are other characteristics (clarity, flexibility, robustness, ...) that could be more useful. -- Ned Batchelder

Re: Explanation of list reference

2014-02-14 Thread Ned Batchelder
in Python refer to values. Thinking in terms of memory locations might just confuse things. This is my best explanation of the details: http://nedbatchelder.com/text/names.html -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Explanation of list reference

2014-02-14 Thread Ned Batchelder
like an int. This covers all the details, including pictures like Marko's, but with an explanation why we draw the ints inside the boxes: http://nedbatchelder.com/text/names.html -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Explanation of list reference

2014-02-14 Thread Ned Batchelder
of it like -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Operator precedence table questions

2014-02-15 Thread Ned Batchelder
as: (a + b) + c but: a b c is not the same as: (a b) c -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: random.sample with large weighted sample-sets?

2014-02-16 Thread Ned Batchelder
'), (0+20, 'orange'), (0+20+50, 'grape'), ] Each number is the cumulative probability up to but not including the item. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Explanation of list reference

2014-02-16 Thread Ned Batchelder
have actually debugged problems where that was the root cause. If you use x is not None, nothing about x's class can interfere with the correct operation. Something like a C compiler manual advising: You can write x*8 but its better to drop out into asm and write shl $3, %eax -- Ned

Re: Explanation of list reference

2014-02-16 Thread Ned Batchelder
to teach, because you have to undo the things they learned about their earlier language X, but which they mistakenly believe to be true about all programming languages. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Does CPython already has Peephole optimizations?

2014-02-17 Thread Ned Batchelder
all those optimizations. I tried filing a bug about it (http://bugs.python.org/issue2506), but it did not win the popular support I had hoped for. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Why is the interpreter is returning a 'reference'?

2014-02-17 Thread Ned Batchelder
a big deal, but I am just curious as to why it does this. You have to invoke s.upper, with parens: k = [s.upper() for s in k] In Python, a function or method is a first-class object, so s.upper is a reference to the method, s.upper() is the result of calling the method. -- Ned Batchelder

Re: Cross-platform way to get default directory for binary files like console scripts?

2014-02-20 Thread Ned Batchelder
know what to do if the file you're looking for isn't in that directory. Perhaps the shorter answer is, look in the Python executable directory, then look in the directories on PATH. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Cross-platform way to get default directory for binary files like console scripts?

2014-02-20 Thread Ned Batchelder
', 'easy_install-2.7', 'pip', 'pip-2.7', 'python', 'python2', 'python2.7'] -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Cross-platform way to get default directory for binary files like console scripts?

2014-02-20 Thread Ned Batchelder
On 2/20/14 10:55 AM, Oscar Benjamin wrote: On 20 February 2014 15:42, Ned Batchelder n...@nedbatchelder.com wrote: As roundabout and advanced as that code is, it doesn't give the right answer for me. It returns None. On my Mac, after activating a virtualenv: Python 2.7.2 (default, Oct

Re: Can global variable be passed into Python function?

2014-02-21 Thread Ned Batchelder
, they work exactly the same as Javascript or Ruby variables. Python's variables are names bound to values. http://nedbatchelder.com/text/names.html has lots more details. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Can global variable be passed into Python function?

2014-02-21 Thread Ned Batchelder
On 2/21/14 9:47 PM, Dennis Lee Bieber wrote: On Fri, 21 Feb 2014 09:59:17 -0800, Travis Griggs travisgri...@gmail.com declaimed the following: On Feb 21, 2014, at 4:13 AM, Ned Batchelder n...@nedbatchelder.com wrote: Man, do I hate this idea that Python has no variables. It has variables

Re: Can global variable be passed into Python function?

2014-02-21 Thread Ned Batchelder
On 2/21/14 10:28 PM, Steven D'Aprano wrote: On Fri, 21 Feb 2014 07:13:25 -0500, Ned Batchelder wrote: On 2/21/14 2:23 AM, dieter wrote: Samlightai...@gmail.com writes: I need to pass a global variable into a python function. Python does not really have the concept variable. What appears

Re: Can global variable be passed into Python function?

2014-02-27 Thread Ned Batchelder
, that Python *does* have the concept of a variable, it just behaves differently than some other popular programming languages (but exactly the same as some other popular programming languages!) -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Can global variable be passed into Python function?

2014-02-28 Thread Ned Batchelder
that cannot be expressed as a switch statement (because it uses ), and then conclude that Python needs a switch statement? That doesn't make any sense. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Can global variable be passed into Python function?

2014-02-28 Thread Ned Batchelder
On 2/28/14 8:08 PM, Mark H. Harris wrote: On Friday, February 28, 2014 6:40:06 PM UTC-6, Ned Batchelder wrote: I don't understand: you show an if/elif chain that cannot be expressed as a switch statement (because it uses ), and then conclude that Python needs a switch statement

Re: Tuples and immutability

2014-03-01 Thread Ned Batchelder
extreme, and bring their own infelicities, and the actual problems caused by this scenario are vanishingly small. BTW: I also am mystified why you uses ellipses to end your sentences, surely one period would be enough? :) -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org

Re: why indentation should be part of the syntax

2014-03-02 Thread Ned Batchelder
there's some engineer at Apple who meant for the code to read like this: if ((err = SSLHashSHA1.update(hashCtx, signedParams)) != 0) { goto fail; goto fail; } This looks to me like a poorly handled merge conflict maybe? I wonder if we'll ever get the details. -- Ned

Re: Functional programming

2014-03-02 Thread Ned Batchelder
Haskell. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: How security holes happen

2014-03-04 Thread Ned Batchelder
backend is Python. Skip It's Hy: http://hylang.org -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Working with the set of real numbers

2014-03-05 Thread Ned Batchelder
about the FSR, and absurdly seems to think hinting at paper and pencil will convince us he is right. Don't engage with him on this topic. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Critic: New Python Front Page

2014-03-08 Thread Ned Batchelder
is on github, and they are taking and resolving issues there: https://github.com/python/pythondotorg/issues -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Critic: New Python Front Page

2014-03-08 Thread Ned Batchelder
On 3/8/14 8:31 AM, Ned Batchelder wrote: On 3/8/14 7:44 AM, Nils-Hero Lindemann wrote: Hi, (Please forgive (or correct) my mistakes, i am non native) http://www.python.org/community/sigs/retired/parser-sig/towards-standard/ * Formatting bug * Needs breadcrumb navigation (Where am i?) (i

Re: Python performance

2014-03-08 Thread Ned Batchelder
of Python. It uses a JIT to produce native code automatically, and can impressively speed up the execution of Python programs. You should give it a try to see if it will help in your situation. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python

Re: How is unicode implemented behind the scenes?

2014-03-08 Thread Ned Batchelder
specified in PEP 393: http://legacy.python.org/dev/peps/pep-0393/ -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Balanced trees

2014-03-10 Thread Ned Batchelder
to do with your style. It can be brief and contrarian, which puts people off. Perhaps if you tried to understand the gap and bridge it more, people would be less inclined to think that you were trying to widen the gap. --Ned. Marko -- Ned Batchelder, http://nedbatchelder.com -- https

Re: when to use == and when to use is

2014-03-10 Thread Ned Batchelder
. The last sentence seems telling to me: if you don't care if objects are equal, then don't use ==. Of course, a long change of if's to figure out which object you have seems odd to me... --Ned. George -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python

Re: running python 2 vs 3

2014-03-20 Thread Ned Batchelder
of bytecode (and therefore .pyc files) across versions of Python, so if you want to run from pure .pyc files, you have to be sure to use the same version of Python that produced the files. --Ned. Marko -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo

Re: running python 2 vs 3

2014-03-20 Thread Ned Batchelder
-Linux, python is python3... Yes, and they have been told many times that this was foolish and wrong, but it persists, much to our pain. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list

Re: running python 2 vs 3

2014-03-20 Thread Ned Batchelder
project, you decide between Python 2 and Python 3 and go all in. Plenty of people have adopted a dual-support strategy, with one code base that supports both Python 2 and Python 3. The six module can help a great deal with this. Marko -- Ned Batchelder, http://nedbatchelder.com

Re: running python 2 vs 3

2014-03-20 Thread Ned Batchelder
On 3/20/14 4:42 PM, Marko Rauhamaa wrote: Ned Batchelder n...@nedbatchelder.com: Plenty of people have adopted a dual-support strategy, with one code base that supports both Python 2 and Python 3. The six module can help a great deal with this. I wonder how easy the resulting code

Re: running python 2 vs 3

2014-03-20 Thread Ned Batchelder
On 3/20/14 4:59 PM, Marko Rauhamaa wrote: Ned Batchelder n...@nedbatchelder.com: It's an extreme case, but the latest released version of coverage.py supports Python 2.3 through 3.3 with one code base. To do it, there's a compatibility layer (akin to six). Then you stay away from features

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