Re: OT Re: Math-embarrassment results in CS [was: Should non-security 2.7 bugs be fixed?]

2015-07-22 Thread Steven D'Aprano
On Thursday 23 July 2015 03:48, Paul Rubin wrote: > Steven D'Aprano writes: >> That's wrong. If we had such a reason, we could state it: "the reason >> we expect natural numbers are irreducible is ..." and fill in the >> blank. But I don't beli

Re: Can I copy/paste Python code?

2015-07-22 Thread Steven D'Aprano
On Thursday 23 July 2015 05:35, Grant Edwards wrote: > On 2015-07-22, Emile van Sebille wrote: >> Well, I select and right click copy then right click paste in where I >> want it. I never got into the center click options. > > That must be using something other than the standard X11 clipboard

Re: convert output to list(and nested dictionary)

2015-07-22 Thread Steven D'Aprano
On Thursday 23 July 2015 06:40, Mark Lawrence wrote: > On 22/07/2015 18:57, max scalf wrote: >> Hi Peter, >> >> Could you please explain what i am doing wrong? > > Amongst other things you're top posting. That is heavily frowned on > here. Please intersperse your replies or bottom post, thank y

Re: Encoding of Python 2 string literals

2015-07-22 Thread Steven D'Aprano
On Thursday 23 July 2015 07:26, Mark Lawrence wrote: > Oh, and please do not tell me to back off. It has been show in recent > days that despite my problems I have contributed to core Python. > Anatoly will contribute to any project, but on his terms, and his terms > only. I have never done any

Re: unexpected output while using list(and nested dictionary)

2015-07-22 Thread Steven D'Aprano
On Thursday 23 July 2015 08:09, max scalf wrote: > Hello List, > > I have posted a question on stack overflow for better readability ... but > is intended for python list Please see question below... If it's intended for here, please ask it here. Consider that there may be people here who a

Re: [OT] Can I copy/paste Python code?

2015-07-22 Thread Steven D'Aprano
On Thursday 23 July 2015 07:56, Michael Torrie wrote: > Though it seems to me Linux desktops are becoming more and more like > Windows in the ways that drove me to really like X11 desktops. For > example, client-side decorations always bugged me in Windows especially > when an app would freeze an

Re: OT Re: Math-embarrassment results in CS [was: Should non-security 2.7 bugs be fixed?]

2015-07-22 Thread Steven D'Aprano
On Thursday 23 July 2015 04:09, Rustom Mody wrote: > tl;dr To me (as unprofessional a musician as mathematician) I find it > arbitrary that Newton *discovered* gravity whereas Beethoven *composed* > the 9th symphony. Newton didn't precisely *discover* gravity. I'm pretty sure that people before

Re: global and loop control variable

2015-07-23 Thread Steven D'Aprano
erature is:", temperature There's no meaningful difference between the example Candide gave (for i in range) and the example you give (for temperature in range). They both use a global for the loop variable. Only the names differ. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: unexpected output while using list(and nested dictionary)

2015-07-23 Thread Steven D'Aprano
from it in the future, and (2) limiting the number of people who are willing and able to answer. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Gmail eats Python

2015-07-25 Thread Steven D'Aprano
honGivesYouWhenYouTryThisWithScalars: >>>> whatever_you_want_to_do_when_this_happens > > Ow! Gmail is understanding the >>> I stuck in as 'this is from the > python console as a quoting marker and thinks it can reflow that. That's one of the reasons I have my Python prompt set to

Re: scalar vs array and program control

2015-07-25 Thread Steven D'Aprano
ef my_function(arg): if isinstance(arg, Number): return _my_function(arg) else: for x in arg: y = _my_function(x) # stick y in some sort of array # return the array of y values -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Gmail eats Python

2015-07-25 Thread Steven D'Aprano
Gnus is lying. Despite containing non-ASCII bytes (i.e. octal \302\240), it sends these headers: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit US-ASCII is 7-bit only and only defines values for ord \0 through \177 in octal. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: 42**1000000 is CPU time free

2015-07-25 Thread Steven D'Aprano
ven no, optimization. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Gmail eats Python

2015-07-26 Thread Steven D'Aprano
although he uses a Gmail account, I see no sign that this particular message went via Gmail. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Questions - July 25, 2015

2015-07-26 Thread Steven D'Aprano
mber you want. Presumably you want the latest version. Click through to here: http://sourceforge.net/projects/numpy/files/NumPy/1.9.2/ Look ma, pre-built installers for Windows! -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Gmail eats Python

2015-07-26 Thread Steven D'Aprano
nix, and used the tools the uni supplied, or a standalone Mac 512K (if you were lucky) or Mac 128K (if you weren't), and again, you used the tools they supplied. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Questions - July 25, 2015

2015-07-28 Thread Steven D'Aprano
e-bones installation of Python + the conda package manager only, so you can pick and choose which of those 195 packages are installed. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Questions - July 25, 2015

2015-07-28 Thread Steven D'Aprano
ling. This library lets a C-like language call functions with > runtime-determined argument types. How would that be used in Python?) https://en.wikipedia.org/wiki/Libffi -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Logical Query in Python

2015-07-30 Thread Steven D'Aprano
ase: - show an example of what you tried; - give the results you expected; - show the results you actually got. COPY and PASTE the code and results, do not re-type them, or summarise them. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Interactive entered code, inserts spurious numbers.

2015-07-31 Thread Steven D'Aprano
rite("%2d: %6.4f\n" % (a, a * pi / frac)) -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: GvR Europython keynote described on lwn.net

2015-07-31 Thread Steven D'Aprano
static type hinting for Python, with the emphasis on proving program correctness, not speed, specifically because they want a big positive gain for moving to Python 3. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: __main__ vs official module name: distinct module instances

2015-08-02 Thread Steven D'Aprano
don't wish to do that, you're screwed, and I think that the best you can do is program defensively by detecting the problem after the event and bailing out: # untested import __main__ import myactualfilename if os.path.samefile(__main__.__path__, myactualfilename.__path__): raise RuntimeError -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: GvR Europython keynote described on lwn.net

2015-08-02 Thread Steven D'Aprano
On Sun, 2 Aug 2015 04:57 am, Rick Johnson wrote: > On Saturday, August 1, 2015 at 12:45:45 AM UTC-5, Steven D'Aprano wrote: > >> > Yep, even the BDFL is actively developing in 2.7! He's no fool. >> >> Of course not. Dropbox pay him to work on their sys

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-02 Thread Steven D'Aprano
q__(self, other): if self is other: return True if not isinstance(other, MyTuple): return NotImplemented if len(self) != len(other): return False d = self+self return other in d def __hash__(self): return hash(frozenset(self)) -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: GvR Europython keynote described on lwn.net

2015-08-02 Thread Steven D'Aprano
On Mon, 3 Aug 2015 08:34 am, Rick Johnson wrote: >> Just because company X is using 2.7, why does that mean >> that *you* shouldn't using 3.x? Surely you should make >> your own decision, based on your own needs. > > It's not just *ANY* company Steven, it&#

Re: how to determine for using c extension or not ?

2015-08-03 Thread Steven D'Aprano
s the bisect file come from? '_bisect' py> import _bisect py> _bisect.__file__ '/usr/local/lib/python2.7/lib-dynload/_bisect.so' So you can see that _bisect is a .so file (on Linux; on Windows it will be a .dll file), which means written in C. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Most Pythonic way to store (small) configuration

2015-08-03 Thread Steven D'Aprano
and a steady hand. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: How to import a function from another module...

2015-08-03 Thread Steven D'Aprano
? What you are trying to do with importlib is fight the language. Your life will be much simpler if you work within the parameters of how the language is designed to work. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Steven D'Aprano
On Wednesday 05 August 2015 05:59, Ben Finney wrote: > [email protected] writes: > >> Why not use Python files itself as configuration files? > > Because configuration data will be user-editable. (If it's not > user-editable, that is itself a poor design choice.) > > If you allow executab

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Steven D'Aprano
cts. The keys are ordinary strings. help(plistlib) The property list (.plist) file format is a simple XML pickle supporting basic object types, like dictionaries, lists, numbers and strings. Usually the top level object is a dictionary. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: QUEST: does HACKING make FOR loop quicker.

2015-08-05 Thread Steven D'Aprano
On Thursday 06 August 2015 10:29, Michael Torrie wrote: > On 08/05/2015 03:39 PM, Mark Lawrence wrote: >> On 05/08/2015 21:00, John Doe wrote: >> >> Three strikes and you're out, good bye troll. > > While the original post is incomprehensible to me, I see only one post. > What were the other tw

Re: Most Pythonic way to store (small) configuration

2015-08-06 Thread Steven D'Aprano
On Thursday 06 August 2015 10:07, Chris Angelico wrote: > On Thu, Aug 6, 2015 at 9:43 AM, Tim Chase > wrote: >> Significant whitespace? Not usually simple (just stuck touching a >> project where someone committed with tons of trailing whitespaces. >> grumble), so strip 'em off as if they're an e

Which Python implementation am I using?

2015-08-07 Thread Steven D'Aprano
available? How about PyPy, Stackless, or others? Is there a definitive test (other than python_implementation) for CPython itself? I'd like to detect that specifically, and leave the default python-with-no-c for those cases where I really am running some unknown Python implementation. Test

Re: Importing is partially working...

2015-08-10 Thread Steven D'Aprano
ary and a spam.pyd interface to that library. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: [Meta] How to post properly (was: Re: Hooking Mechanism when Entering and Leaving a Try Block)

2015-08-13 Thread Steven D'Aprano
topic. That is: - posts about the main topic (here, that would be Python) are on-topic; - posts about posting are meta; - everything else is off-topic. We have a reasonable tolerance to off-topic discussions, particularly if they evolve naturally from an on-topic one. -- Steven

Re: Module load times

2015-08-13 Thread Steven D'Aprano
del, it is difficult to predict the impact of importing. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Mock object but also assert method calls?

2015-08-13 Thread Steven D'Aprano
`assert` see this: http://import-that.dreamwidth.org/676.html -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Dave Angel RIP

2015-08-18 Thread Steven D'Aprano
far too young an age of 66. He will be missed. http://www.monaghanfunerals.com/obits/obituary.php?id=552157 Thanks to Alan Gould on the tutor mailing list for passing this information on. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Permission denied error in download nltk_data...

2015-08-19 Thread Steven D'Aprano
terminal and get a command line prompt? **NOT** a Python prompt: if you see the prompt ">>>" type "quit()" and enter. You should have a prompt $ or % or similar. At the prompt, type: whoami ls -ld /Users/dwightgoldwindex/ ls -ld /Users/dwightgoldwindex/nltk_data

Re: Check if dictionary empty with == {}

2015-08-19 Thread Steven D'Aprano
uot;mydict = {1:2}" \ > "if isinstance(mydict, dict) and not mydict: pass" 100 loops, best of 3: 0.257 usec per loop So maybe it's a micro-optimization? TL;DR There's nothing wrong with it. It is ever-so-subtly different from the various alternatives, so if you change it, don't be surprised if you break something. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Storing dictionary locations as a string and using eval - alternatives?

2015-08-19 Thread Steven D'Aprano
elow as shown: > with open(input_file, 'r') as f: > json_points = [] > for line in f: > if line.startswith("{"): [...] > for key, value in metrics_to_extract.items(): > json_points.append(add_point(key, eval(value), timestamp, > tags)) for key, names in metrics_to_extract.items(): value = get_nested_items(server_status_json, *names) point = add_point(key, value, timestamp, tags) json_points.append(point) -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Check if dictionary empty with == {}

2015-08-20 Thread Steven D'Aprano
On Thu, 20 Aug 2015 11:54 pm, Skip Montanaro wrote: > On Wed, Aug 19, 2015 at 10:16 PM, Steven D'Aprano < > [email protected]> wrote: > >> So maybe it's a micro-optimization? > > > Note, however, that the original post compared &qu

Re: SQLite3 and web server

2015-08-20 Thread Steven D'Aprano
esn't seem to be related to Python in any way. Just because the web server is written in Python doesn't mean that it's a Python problem. Your web page is generated from Javascript, not Python. Making-the-Internet-a-worse-place-one-piece-of-Javascript-at-a-time-ly y'rs, --

Re: how to handle cpu cache in python ( or fastest way to call a function once)

2015-08-23 Thread Steven D'Aprano
steve@ando ~]$ python2.7 e.py 15.9740447998 12.8746032715 12.1593475342 10.9672546387 [steve@ando ~]$ python2.7 e.py 15.9740447998 20.0271606445 15.0203704834 15.9740447998 -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: how to handle cpu cache in python ( or fastest way to call a function once)

2015-08-23 Thread Steven D'Aprano
es not make any difference. Whatever is going on here, it isn't as simple as "range(100) builds a giant list". -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: isinstance() and multiple inheritance/ctypes

2015-08-27 Thread Steven D'Aprano
od somewhere that I'm not aware > of? Yes -- see Terry Reedy's post. isinstance(inst, klass) ends up calling type(klass).__instancecheck__(klass, inst) -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Python used in malware

2015-08-27 Thread Steven D'Aprano
It's old news, but I found this interesting: some malware installs Python for ease of scripting bots: http://www.theregister.co.uk/2014/11/06/hackers_use_gmail_drafts_as_dead_drops_to_control_malware_bots/ -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: isinstance() and multiple inheritance/ctypes

2015-08-27 Thread Steven D'Aprano
On Fri, 28 Aug 2015 12:33 am, Chris Angelico wrote: > On Thu, Aug 27, 2015 at 10:59 PM, Steven D'Aprano > wrote: >> On Thu, 27 Aug 2015 09:14 am, Chris Angelico wrote: >> >>> On Thu, Aug 27, 2015 at 9:12 AM, Chris Angelico >>> wrote: >>>> O

OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests]

2015-08-27 Thread Steven D'Aprano
aking it. Alas, that appears to be false: no matter how terrible war is, there is always someone who thinks that it is better than peace. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: OFF-TOPIC Ben's sig monster quote [was Re: Parametrized Unit Tests]

2015-08-28 Thread Steven D'Aprano
ils, yourself. "Crivens! I kicked meself in ma ain heid!" -- Steven "Nae King! Nae Quin! Nae Laird! Nae Master! We'll no be fooled again!" -- https://mail.python.org/mailman/listinfo/python-list

Re: Casting to a "number" (both int and float)?

2015-08-30 Thread Steven D'Aprano
or indeed something else) is a better solution. But it is completely legitimate to suggest that the current solution is sub-optimal and another would be better. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Does mkstemp open files only if they don't already exist?

2015-09-01 Thread Steven D'Aprano
I assume the answer is "Yes", but is it safe to expect that tempfile.mkstemp() will only create a file that doesn't already exist? I presume that there's no chance of it over-writing an existing file (say, due to a race-condition). -- Steven -- https://mail.python.org/mai

Low level file descriptors and high-level Python files

2015-09-01 Thread Steven D'Aprano
ct, I can inspect file_obj.closed and it will tell me whether the file is open or not. Is there an equivalent for file descriptors? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Why Python is not both an interpreter and a compiler?

2015-09-01 Thread Steven D'Aprano
the Python compiler and interpreter, which effectively means that the Python runtime has to be *all* of Python, or at least nearly all. There may be projects that will compile Python down to machine code for a real machine (perhaps Cython?) but doing so isn't easy, which is why most compilers don't do it. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Why Python is not both an interpreter and a compiler?

2015-09-01 Thread Steven D'Aprano
On Wed, 2 Sep 2015 02:20 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >> I believe that Marko is wrong. It is not so easy to compile Python to >> machine language for real machines. That's why the compiler targets a >> virtual machine instead. > > Som

Re: packing unpacking depends on order.

2015-09-02 Thread Steven D'Aprano
really happy with them. I think python > should give the second result in both cases. Apart from breaking backwards compatibility, how would you implement such a thing? A simple left-to-right assignment rule is easy to implement and easy to understand even when the targets depend on each other. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: for loop over function that returns a tuple?

2015-09-02 Thread Steven D'Aprano
metric_data straight from > get_metrics through to create_point. > > However, in this case, metric_data only contains timestamp. I don't understand this. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: for loop over function that returns a tuple?

2015-09-02 Thread Steven D'Aprano
= values # final time through the loop, metric_data = tags Get rid of the loop, and write this: metric_data = get_metrics(server_status_json, mmapv1_metrics, line_number) json_points.append(create_point(*metric_data)) -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Raymond Hettinger is now featured on ActiveState

2015-09-02 Thread Steven D'Aprano
om/recipes/users/178123/ -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Atomic file save -- code review and comments requested

2015-09-02 Thread Steven D'Aprano
nction may fail and lose data? One question comes to mind -- should I perform a flush and/or sync of the file before the rename? Thanks in advance for all constructive comments. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: packing unpacking depends on order.

2015-09-02 Thread Steven D'Aprano
Try to write an algorithm that gives the result you want, one which supports all the cases including the case where one or both of a and b don't exist prior to the assignments. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-02 Thread Steven D'Aprano
at global variables do you have now? > I have disliked this already in PHP where one has to do > exact the same thing as in Python (and hoped Python does it better, but > not). And using an import here is no solution, cause this is > something which relates only to the scope and s

Re: Python handles globals badly.

2015-09-03 Thread Steven D'Aprano
On Fri, 4 Sep 2015 02:43 am, Michael Torrie wrote: > Sadly Skybuck probably ditched Python a long time ago "Sadly"? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-03 Thread Steven D'Aprano
s globals is silly. The only time that is harmful is if you intend to use the global in a function but have a local of the same name. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-03 Thread Steven D'Aprano
.elif? Out of the dozen or so different switch statements offered by other languages, which would you choose? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Program in or into (was Python handles globals badly)

2015-09-05 Thread Steven D'Aprano
list slices and the ability to treat lists/arrays as first class values, that make Python so easy to work with. If C# lacks those features, how do you expect to use them? Lacking some of those features (or at least having significant downsides to the use of them) is why idiomatic C# or Java code lo

Re: python

2015-09-06 Thread Steven D'Aprano
On Mon, 7 Sep 2015 09:09 am, babi pepek wrote: > I wand update Okay. Is that a question, or are you just telling us? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-08 Thread Steven D'Aprano
re best written with 0-based arrays, and some are best with 1-based arrays. I shouldn't have to change languages to change from one to the other! -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-08 Thread Steven D'Aprano
On Wed, 9 Sep 2015 09:55 am, Michael Torrie wrote: > On 09/08/2015 09:56 AM, Steven D'Aprano wrote: >> http://exple.tive.org/blarg/2013/10/22/citation-needed/ >> >> It's a wonderful read. > > I read this article, but I'm still uncertain to what his po

Re: Python handles globals badly.

2015-09-08 Thread Steven D'Aprano
lazy evaluation. So there was no existing alternative to a ternary if expression that worked correctly. In the case of case/switch, there is no consensus on what the statement should do, how it should work, what purpose it has, or what syntax it should use. Rather than "there's no alternative to a case statement", the situation was more like "there are many good alternatives to the various different case statements people want". -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-09 Thread Steven D'Aprano
On Thu, 10 Sep 2015 02:09 am, Christian Gollwitzer wrote: > Am 09.09.15 um 05:23 schrieb Steven D'Aprano: >> And yes, the fellow Joe who completely missed the point of the blog post, >> and made the comment "You don’t think you’re wrong and that’s part of a >>

Re: Python 3.3 couldnt find its libraries.

2015-09-09 Thread Steven D'Aprano
ed to edit /etc/ld.so.conf and add this line to the end: /this/that Save your changes, run ldconfig again, and hopefully python3 will now work. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-09 Thread Steven D'Aprano
t the computing industry may never recover from the harm done to it by the widespread use of C. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: textfile: copy between 2 keywords

2015-09-10 Thread Steven D'Aprano
f: # continue from just after the STOP keyword. pass # This is a waste of time... print("Done!") -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-10 Thread Steven D'Aprano
ken, I think that there is near-universal agreement that the single biggest factor in C's popularity and growth during the 1970s and 80s is that it was tied so intimately to Unix, and Unix was taking over from mainframes, VAX, etc. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-10 Thread Steven D'Aprano
On Thu, 10 Sep 2015 04:23 am, Emile van Sebille wrote: > On 9/9/2015 10:55 AM, Steven D'Aprano wrote: > >> (I wanted to link to the "Everything Is Broken" essay on The Medium, but >> the page appears to be gone. > > Is this it? > http://www.sott.net/

Re: Python handles globals badly.

2015-09-10 Thread Steven D'Aprano
e page appears to be gone. This makes me sad. BTW, what's the point of >> Google's cache when it just redirects to the original, missing, page?) > > Do you mean https://medium.com/message/everything-is-broken-81e5f33a24e1 ? Yes, that's the one, thanks. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-10 Thread Steven D'Aprano
On Thu, 10 Sep 2015 04:59 am, [email protected] wrote: > On Wed, Sep 9, 2015, at 13:55, Steven D'Aprano wrote: >> In fairness to the C creators, I'm sure that nobody back in the early >> seventies imagined that malware and security vulnerabilities would be as >>

Context-aware return

2015-09-10 Thread Steven D'Aprano
terpreter prints "Awesome" Is such a thing possible, and if so, how would I do it? If I did this thing, would people follow me down the street booing and jeering and throwing things at me? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-10 Thread Steven D'Aprano
On Fri, 11 Sep 2015 02:31 am, [email protected] wrote: > On Thu, Sep 10, 2015, at 11:59, Steven D'Aprano wrote: >> Although, I'm not sure that I agree with the idea that "everything is an >> expression". I think that's a category mistake, like aski

Re: Python handles globals badly.

2015-09-11 Thread Steven D'Aprano
Evangelists, ... . >> Presumably no core Python Programmers (wrting compiler and standard >> library stuff) > > Ad hominem. For the record, I am the author of the statistics module in Python 3.4, and Terry Reedy is the very active maintainer of IDLE. If I have missed anyone, my apologies. So, yes, there are core developers here. (Although not any of the senior core devs, as far as I know.) -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-11 Thread Steven D'Aprano
ere's an argument to be made that, clean or not, assignment as an expression is useful. So be it -- other languages do that. I personally find it more confusing and annoying than useful when I come across it, but YMMV. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-12 Thread Steven D'Aprano
On Sat, 12 Sep 2015 01:03 am, Ian Kelly wrote: > On Fri, Sep 11, 2015 at 2:42 AM, Steven D'Aprano > wrote: [...] >> Almost. If it's never assigned within the function, then it is looked up >> according to the non-local scoping rules: >> >> -

Re: Terminology: “reference” versus “pointer”

2015-09-12 Thread Steven D'Aprano
o dereference operator, and no "pointer" type; values do not necessarily have fixed addresses (indeed, in Jython and IronPython, values can move in memory). Insisting that Python has pointers is like insisting that you use a text editor by flipping bits. "What happens if I

Re: Terminology: “reference” versus “pointer”

2015-09-12 Thread Steven D'Aprano
;Joe, I think our son might be lost in the woods" "Don't worry, I have his social security number" http://effbot.org/zone/call-by-object.htm. Python values are not addresses. Python values are objects. Addresses, even when they exist, are not accessible in the Python language. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Steven D'Aprano
small icon whose movement across the screen follows that of the mouse, trackball or other pointing device; - a signpost or milepost; and more. I don't think that arguing on the basis of lay-English or plain English terms is going to be terribly useful. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Steven D'Aprano
unction has here? Note: when I write my own Python implementation, all IDs will be negative odd numbers. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Steven D'Aprano
ge programmer today is of continuations and futures. But this is not that day. > FYI (the general you), I am capable of extracting the > general principle and applying it to Python. Not just capable, but > using the concept from C made understanding Python faster than pretending >

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Steven D'Aprano
model. In order to interact with pointers, you have to drop out of Python altogether, and start programming in the implementation language C, or use an interface to C such as ctypes. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Steven D'Aprano
imit yourself to no more than four hatch marks, taken from the set of "|/\X<>", that gives you 1554 distinct markers. If you need to identify more than 1554 distinct objects on one diagram, I suggest your diagram is a tad too complex. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-13 Thread Steven D'Aprano
> > How does it become writeable then ? It's always writeable. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2015 04:45 am, [email protected] wrote: > On 09/12/2015 10:32 AM, Steven D'Aprano wrote: >> On Sat, 12 Sep 2015 02:42 pm, Random832 wrote: >>[...] >> Computer science and IT is *dominated* by a single usage for "pointer" -- >> it

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2015 10:50 pm, Steven D'Aprano wrote: > On Sun, 13 Sep 2015 04:45 am, [email protected] wrote: ... ^ > But as I said to Rurpy, Er, that would be you. Editing fail. Sorry about that. -- Steven -- https://mail.python.org/mailman/list

Re: convert element in a list to float

2015-09-13 Thread Steven D'Aprano
e-cast syntax `(float)value`? Whatever it was that gave you this wrong impression needs to be fixed. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Steven D'Aprano
On Mon, 14 Sep 2015 09:17 am, Akira Li wrote: > I don't see why the model that can't describe range(1) in Python 3 > pretends to be complete. Please explain. range(1) returns a range instance. What is hard about that? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Steven D'Aprano
On Mon, 14 Sep 2015 11:22 am, Akira Li wrote: > Steven D'Aprano writes: > >> On Mon, 14 Sep 2015 09:17 am, Akira Li wrote: >> >>> I don't see why the model that can't describe range(1) in Python 3 >>> pretends to be complete. >> >

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Steven D'Aprano
rom a C-level datastructure inaccessible to pure Python code. Unless you are the author of the range class, you don't really have any business worrying about whether range.start is a "reference" to the start value, or something computed on the fly as needed. It could be either. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Steven D'Aprano
On Mon, 14 Sep 2015 01:23 pm, Akira Li wrote: > Steven D'Aprano writes: > >> On Mon, 14 Sep 2015 11:22 am, Akira Li wrote: >>> Look at the last example: >>> http://thread.gmane.org/gmane.comp.python.general/782626/focus=782704 >> >> >> I&#x

Re: Terminology: "reference" versus "pointer"

2015-09-15 Thread Steven D'Aprano
tuples would require a rather lot of memory. The difference between "a lot" and "three times a lot" could be significant. But other than memory efficiency, yes, you are correct, there's no real reason to care about the difference between the two cases. -- Steven --

Re: Terminology: "reference" versus "pointer"

2015-09-15 Thread Steven D'Aprano
On Tue, 15 Sep 2015 03:34 am, Random832 wrote: > On Mon, Sep 14, 2015, at 13:03, Steven D'Aprano wrote: >> On Tue, 15 Sep 2015 01:10 am, Random832 wrote: >> > That's not true in CPython. In fact, the range object in python >> > contains *four* reference

<    75   76   77   78   79   80   81   82   83   84   >