Re: enhancement request: make py3 read/write py2 pickle format

2015-06-09 Thread random832
On Tue, Jun 9, 2015, at 23:52, Steven D'Aprano wrote: > > For human readable serialized data, text format protocol buffers are > > seriously underrated. (Relatedly: underdocumented, too.) > > Ironically, literal_eval is designed to process text-format protocols > using > human-readable Python syn

Re: enhancement request: make py3 read/write py2 pickle format

2015-06-10 Thread random832
On Wed, Jun 10, 2015, at 08:08, Marko Rauhamaa wrote: > You can't serialize/migrate arbitrary objects. Consider open TCP > connections, open files and other objects that extend outside the Python > VM. Also objects hold references to each other, leading to a huge > reference mesh. > > For example:

Re: Python NBSP DWIM

2015-06-10 Thread random832
On Wed, Jun 10, 2015, at 11:03, Laura Creighton wrote: > In these unicode days, this thinking may need to be revisited. There > are many languages where whitespace does not separate words -- either > words aren't separated, or in Vietnamese, spaces separate syllables, > so entire words have spaces

Re: Testing random

2015-06-10 Thread random832
On Wed, Jun 10, 2015, at 13:03, Thomas 'PointedEars' Lahn wrote: > This is _not_ a lottery box; you put the ball with the number on it *back > into the box* after you have drawn it and before you draw a new one. Yes, but getting a 2, putting it back, and getting a 1 is just as good as getting a 1

Re: enhancement request: make py3 read/write py2 pickle format

2015-06-10 Thread random832
On Wed, Jun 10, 2015, at 19:30, Gregory Ewing wrote: > If whitelisting a type is the *only* thing you need to > do to make it serialisable, I think that comes close > enough to the stated goal of being able to "serialise > all [potentially serialisable] language objects". IMO the serialization fra

Re: Python NBSP DWIM

2015-06-10 Thread random832
On Wed, Jun 10, 2015, at 20:09, Chris Angelico wrote: > And U+FEFF "ZERO WIDTH NO-BREAK SPACE", notable because it's also used as > the byte-order mark (as its counterpart, U+FFFE, is unallocated). I've > been > fighting with VLC Media Player over the font it uses for subtitles; for > some bizarre

Re: Python NBSP DWIM

2015-06-10 Thread random832
On Wed, Jun 10, 2015, at 23:05, Chris Angelico wrote: > http://youtu.be/CEpcUeWP0bg > http://youtu.be/WFZAaHrHens An example of the actual subtitle text would be more useful than a youtube link to the video, since we're unlikely to be able to see what context the character appears in if our client

Re: How to pretty mathematical formulas in Python? Similar to Mathematica formats.

2015-06-11 Thread random832
On Thu, Jun 11, 2015, at 14:32, Sebastian M Cheung via Python-list wrote: > How to pretty mathematical formulas in Python? Similar to Mathematica > formats. > > Are there good packages to prettify mathematica formulas in Python? >From a google search, apparently matplotlib has a module called mat

Re: How to pretty mathematical formulas in Python? Similar to Mathematica formats.

2015-06-11 Thread random832
On Thu, Jun 11, 2015, at 14:54, random...@fastmail.us wrote: > On Thu, Jun 11, 2015, at 14:32, Sebastian M Cheung via Python-list > wrote: > > How to pretty mathematical formulas in Python? Similar to Mathematica > > formats. > > > > Are there good packages to prettify mathematica formulas in Pyth

Re: os.system error returns

2015-06-12 Thread random832
On Fri, Jun 12, 2015, at 09:54, Ian Kelly wrote: > Exit code 0 traditionally means success. The exit status is two bytes, > with > the low-order byte normally containing the exit code and the high-order > byte containing the signal that caused the program to exit. That's backwards. The signal (or

Re: os.system error returns

2015-06-12 Thread random832
For completeness I will note that Windows is completely different. The plain exit status (1 for typical command failures) appears in the os.system result rather than a wait-encoded value. And, incidentally, an MSVC program which calls abort() will return an exit status of 3. A process that terminat

Re: Testing random

2015-06-12 Thread random832
On Fri, Jun 12, 2015, at 17:32, Thomas 'PointedEars' Lahn wrote: > Ian Kelly wrote: > > > The probability of 123456789 and 1 are equal. The probability > > of a sequence containing all nine numbers and a sequence containing > > only 1s are *not* equal. > > There is a contradiction in that

Re: Testing random

2015-06-12 Thread random832
On Fri, Jun 12, 2015, at 18:09, Thomas 'PointedEars' Lahn wrote: > Do you deny that “123456789” *is* “a sequence containing all nine > numbers” Do you deny that "123456798" *is* "a sequence containing all nine numbers"? Does this mean that "123456789" *is* "123456798" by the transitive property?

Re: Testing random

2015-06-16 Thread random832
On Tue, Jun 16, 2015, at 15:18, Thomas 'PointedEars' Lahn wrote: > There is no such thing as “relative probability”, except perhaps in > popular- > scientific material and bad translations. You might mean relative > _frequency_, but I was not talking about that specifically. The probability of o

Re: Creating .exe file in Python

2015-06-17 Thread random832
On Wed, Jun 17, 2015, at 09:33, hamilton wrote: > However, the python source can be read by anyone. > > As a .exe, the source can not be read. > > Just because the interpreter is open source, > does not mean my application should be. Being readable isn't the same thing as being open source. If s

Re: Documenting a function signature (was: Set a flag on the function or a global?)

2015-06-18 Thread random832
On Wed, Jun 17, 2015, at 20:14, Chris Angelico wrote: > Mostly. That would imply that object is a mandatory parameter, which > AIUI isn't the case for Steven's edir. The downside of this kind of > signature is that it's hard to show the parameters that have unusual > defaults (either sentinel objec

Re: Posting gzip'd image file - server says Malformed Upload?

2015-06-18 Thread random832
On Wed, Jun 17, 2015, at 20:23, Chris Angelico wrote: > On Thu, Jun 18, 2015 at 7:55 AM, Paul Hubert wrote: > > f_in = open(dafile, 'rb') > > f_out = gzip.open('/Users/Paul/Desktop/scripts/pic.jpg.gz', 'wb') > > f_out.writelines(f_in) > > f_out.close() > > f_in.close() > > Are you sure you want i

Re: windows and file names > 256 bytes

2015-06-25 Thread random832
On Thu, Jun 25, 2015, at 09:35, Michael Torrie wrote: > The OP mentions that even when he manually supplies extended paths, > os.mkdir, os.getsize, and shutil.rmtree return errors for him in Python > 2.7. So there's more to this problem. The byte versions of the underlying OS APIs use a 256-chara

Re: Readline -- cannot bind to both Ctrl-tab and tab at the same time?

2015-06-28 Thread random832
On Sun, Jun 28, 2015, at 14:55, Steven D'Aprano wrote: > I'm trying to use a readline binding for both TAB and Ctrl-TAB, but it's > not > working for me. Whichever I install second seems to over-ride the first. Can you bind it directly to whatever escape sequence ctrl-tab produces? Some terminals

Recreate file associations?

2015-06-29 Thread random832
I installed Python 2.1 for historical interest and it associated python files with the python 2.1 interpreter. I installed 3.4 afterwards (I had 3.3 as my latest python version before) expecting this to fix it, but it left it alone. Even deleting all the Python associations from the registry and th

Re: Recreate file associations?

2015-07-01 Thread random832
On Mon, Jun 29, 2015, at 14:25, Terry Reedy wrote: > Registry => Windows. > Did you check [X] Make this my default python? I didn't see any such checkbox, in any of installers I ran. (And, yes, I assumed windows was implied by my subject - other systems python runs on either don't have a notion o

Re: "normalizing" a value

2015-07-01 Thread random832
On Wed, Jul 1, 2015, at 20:12, bvdp wrote: > Not sure what this is called (and I'm sure it's not normalize). Perhaps > "scaling"? > > Anyway, I need to convert various values ranging from around -50 to 50 to > an 0 to 12 range (this is part of a MIDI music program). I have a number > of places whe

Re: "normalizing" a value

2015-07-01 Thread random832
On Wed, Jul 1, 2015, at 21:49, bvdp wrote: > Interesting that negative values translate properly. That's an > non-intuitive result to me. Guess I should have studied that math stuff > harder way back when! There are multiple interpretations of the operation, and not all languages behave the same w

Re: (side-)effects and ...

2015-07-09 Thread random832
On Thu, Jul 9, 2015, at 15:36, Tony the Tiger wrote: > On Sun, 05 Jul 2015 20:29:11 +, Stefan Ram wrote: > > > X-Copyright: (C) Copyright 2015 Stefan Ram. All rights reserved. > > Distribution through any means other than regular usenet channels is > > forbidden. It is forbidden to publish thi

Re: Trouble getting to windows My Documents directory

2015-07-10 Thread random832
The My Documents directory is not guaranteed to be named "Documents". On older versions of windows it was "My Documents", and on foreign versions of windows it is a name in their language. The correct way to get the path of this folder is, for example (couldn't test since I'm on a mac right now)

Re: 0 + not 0

2015-07-11 Thread random832
On Sat, Jul 11, 2015, at 07:20, Chris Angelico wrote: > On Sat, Jul 11, 2015 at 9:12 PM, Luuk wrote: > > It can occur in an arithmetic expression, and 'not' has a higher precedence > > than '+' > > (https://docs.python.org/2/reference/expressions.html#operator-precedence) > > > > I think you're m

Re: Gmail eats Python

2015-07-29 Thread random832
On Sun, Jul 26, 2015, at 02:43, Ian Kelly wrote: > What Internet standard is being violated by reflowing text content in > the message body? Well, implicitly, text is only supposed to be reflowed when format=flowed is in use, and only then when each physical line of the file ends with a space char

Re: Gmail eats Python

2015-07-29 Thread random832
On Sun, Jul 26, 2015, at 07:48, Marko Rauhamaa wrote: > At first, there was only the machine language. Assembly languages > introduced "mnemonics" for the weaklings who couldn't remember the > opcodes by heart. To be fair, x86 is also a particularly terrible example of a machine language, from the

Re: How to re-write this bash script in Python?

2015-07-30 Thread random832
On Thu, Jul 30, 2015, at 14:31, sutanu@gmail.com wrote: > _year=$(date -d "-5 hour" +%Y) > _month=$(date -d "-5 hour" +%m) > _day=$(date -d "-5 hour" +%d) > _hour=$(date -d "-5 hour" +%H) What is the purpose of the -5 hour offset? Is it an attempt to compensate for timezones? -- https://mail.

Re: Trouble getting to windows My Documents directory

2015-07-31 Thread random832
On Sat, Jul 11, 2015, at 03:28, Chris Warrick wrote: > That’s not necessarily “older”. > > Windows XP/7/8: My Documents > Windows Vista/8.1: Documents Mine's called Documents on 7 and 8. Is the system you got this information from a new install or an upgrade? (It may also depend on whether it's a

Re: Most Pythonic way to store (small) configuration

2015-08-04 Thread random832
On Tue, Aug 4, 2015, at 21:32, Michael Torrie wrote: > In many of my projects I put basic config variables in a file like > config.py and import that in each module that needs it. The config > module doubles as a global namespace for sharing between modules as well. What about JSONP? That is, a f

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-08 Thread random832
On Sat, Aug 8, 2015, at 13:59, Laurent Pointal wrote: > > Level? > > Graduate (post-Bac in france) Yours or your students? > > 1. Are you > > grade school (1=12)? > > (sorry, I dont know correspondance in france) Grade 12 refers to 17-18 year old students, each grade is one year. > > undergra

Re: -2146826246 in win32com.client for empty #N/A cell in Excel

2015-08-16 Thread random832
On Sun, Aug 16, 2015, at 14:41, Chris Angelico wrote: > On Mon, Aug 17, 2015 at 3:27 AM, Albert-Jan Roskam > wrote: > > Does that number happen to be -1 * sys.maxint? > > No, it's -1 * 0x7ff5f806. As a signed 32-bit integer, it's 0x800a07fa. > Does either of those numbers mean anything? That's a

Re: why does id(multiprocessing.Process.start) == id(multiprocessing.Process.start)?

2015-08-17 Thread random832
On Mon, Aug 17, 2015, at 18:25, alex.fl...@gmail.com wrote: > Sorry I completely mistype that. It was supposed to read: > > >>> id(multiprocessing.Process.is_alive) == id(multiprocessing.Process.start) > True > > >>> multiprocessing.Process.is_alive is multiprocessing.Process.start > False Try t

Re: TypeCheck vs IsInstance in C API

2015-08-25 Thread random832
On Mon, Aug 24, 2015, at 22:12, Andrew Wang wrote: > Hi. > > I know this thread is ancient, but I would like to know the answer > as well > ( https://mail.python.org/pipermail/python-list/2006-May/413542.html). Of course, the answer in 2015 is actually very different from the answer in 2006, sinc

Re: TypeCheck vs IsInstance in C API

2015-08-25 Thread random832
On Tue, Aug 25, 2015, at 12:56, Terry Reedy wrote: > Huh?? I fail to see the point of this buggy code. ... > The extra marginal '>' quote makes it look like this buggy code was > posted by Andrew, but it comes from random832. Actually, it comes from one of the links I pos

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

2015-08-27 Thread random832
On Fri, Aug 28, 2015, at 00:57, Victor Hooi wrote: > I'm reading JSON output from an input file, and extracting values. > > Many of the fields are meant to be numerical, however, some fields are > wrapped in a "floatApprox" dict, which messed with my parsing. > Is there a way to re-write strip_flo

Re: Low level file descriptors and high-level Python files

2015-09-01 Thread random832
On Tue, Sep 1, 2015, at 10:57, Steven D'Aprano wrote: > Q1: In this example, I know that I opened the fd in write mode, because > I > did it myself. But since I'm not actually opening it, how do I know what > mode to use in the call to fdopen? Is there something I can call to find > out what mode

Re: packing unpacking depends on order.

2015-09-02 Thread random832
On Wed, Sep 2, 2015, at 13:26, Sven R. Kunze wrote: > I agree as well. First evaluate the right side, then assign it to the > left side at once. The behavior, if it's *not* "first evaluating the right side", is indistinguishable from it by this test. Assigning the RHS of each case to a separate l

Re: packing unpacking depends on order.

2015-09-03 Thread random832
On Thu, Sep 3, 2015, at 19:25, Sven R. Kunze wrote: > You mentioned side-effects. That is true. Right now, however, the > side-effects even fire back to the RHS of the assignment. That is really > weird. To me, and as it seems to some other folks here, the RHS should > be at least independent

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

2015-09-05 Thread random832
Steven D'Aprano writes: > That depends. Is the example C# code idiomatic for the language? Not in the least. My first clue was Int32 - nobody actually uses those names. > Or was it > written by somebody ignorant of C#, and consequently is a poor example of > badly-written and unidiomatic "Java

Re: Python handles globals badly.

2015-09-08 Thread random832
On Tue, Sep 8, 2015, at 10:31, Ian Kelly wrote: > I believe this wart is fixed in VB .NET. This is apparently true, but the weird thing is it was done late enough in the design cycle that the .NET runtime still has features meant to support it. You can create such an array with the Array.CreateIns

Re: Python handles globals badly.

2015-09-08 Thread Random832
MRAB writes: > If you're allowed to specify both bounds, why would you be forbidden > from negative ones? It makes it non-obvious what value should be returned from e.g. search methods that return a negative number on failure. .NET's IndexOf function returns -1, but MaxValue if the array has a ne

Re: Python handles globals badly.

2015-09-09 Thread random832
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 > widespread as they have become. But still, the fundamental decisions made > by C are lousy. Assi

Re: PIP does not appear to handle diacritics correctly.

2015-09-09 Thread random832
On Wed, Sep 9, 2015, at 15:59, Tim Golden wrote: > On 09/09/2015 08:59, Laszlo Lebrun via Python-list wrote: > > Yes, you are right, let me append the message. > > Just after a fresh install of Python with PIP on Windows. > > Whenever I start PIP, I get: > > "Fatal error in launcher: Unable to crea

Re: Python handles globals badly.

2015-09-10 Thread random832
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 asking for the speed > of dark[1], or for a bucket of cold. Some things are functional by > nature, > and other th

Re: Python handles globals badly.

2015-09-10 Thread random832
On Thu, Sep 10, 2015, at 12:48, Chris Angelico wrote: > Having assignment be a statement (and therefore illegal in a loop > condition) makes sense. Having it be an expression that yields a > useful or predictable value makes sense. Having it be an expression, > but not returning a value, doesn't.

Re: Python handles globals badly.

2015-09-10 Thread random832
On Thu, Sep 10, 2015, at 14:13, Steven D'Aprano wrote: > Because that's the definition of an expression in this context. An > expression is evaluated to either return a result, or raise an exception. Nonsense. An expression is something allowed within a larger expression. It's easy to imagine an e

Re: Context-aware return

2015-09-10 Thread random832
On Thu, Sep 10, 2015, at 16:15, Akira Li wrote: > There are cases when it might be justified to alter the behavior e.g., > *colorama* allows to strip ANSI codes (e.g., disable colored output) if > stdout is not a tty or *win-unicode-console* make sys.stdout to use > WriteConsoleW() to write Unicode

Re: Python handles globals badly.

2015-09-11 Thread random832
On Fri, Sep 11, 2015, at 03:28, Antoon Pardon wrote: > The error is also facilitated because C doesn't have booleans > and so everything can be used as one. Python does have booleans and everything can be used as one - the logical conclusion is that being able to use everything as a boolean is a

Re: Python handles globals badly.

2015-09-11 Thread random832
On Fri, Sep 11, 2015, at 11:55, Chris Angelico wrote: > On Sat, Sep 12, 2015 at 1:49 AM, Ian Kelly wrote: > > Ah, that makes sense. It's writing into the dict that is created and > > returned by locals(), but not actually updating the frame locals which > > are the source of truth. > > Yeah... bu

Re: Python handles globals badly.

2015-09-11 Thread random832
On Fri, Sep 11, 2015, at 20:01, Michael Torrie wrote: > The secret to understanding the global keyword is to understand how > Python namespaces work. The statement "a=5" does not assign a 5 to the > box called "a." Rather it binds the name "a" to the "5" object, which > is immutable and called in

Re: Python handles globals badly.

2015-09-11 Thread Random832
Mark Lawrence writes: > On 12/09/2015 01:11, random...@fastmail.us wrote: > If everything in Python is an object, how can it assign a pointer? > Especially how do Jython and IronPython assign pointers? The Java and .NET runtimes also have pointers, they just don't [usually] call them pointers, j

Re: Python handles globals badly.

2015-09-11 Thread Random832
Mark Lawrence writes: > My favourite analogy for Python names, the sticky note, here > https://mail.python.org/pipermail/tutor/2006-October/049767.html Is player3[3] also a sticky note? Wouldn't the note have to have the id of player3 written on it somehow? Should the player3 sticky note have the

Re: Python handles globals badly.

2015-09-11 Thread Random832
Mark Lawrence writes: > I think pointer is even worse because of its connection with C and > hence cPython. What is wrong with object if that is the only thing > Python knows about? Because the object is the *thing the arrow points at*. You don't have two objects when store the same object in tw

Re: Terminology: “reference” versus “pointer”

2015-09-11 Thread Random832
Ben Finney writes: > With the significant difference that “pointer” implies that it has its > own value accessible directly by the running program, such as a pointer > in C. Its own value *is* what you're accessing when you assign or return it. You just can't do math on it, but there are lots of

Re: Terminology: “reference” versus “pointer”

2015-09-11 Thread Random832
Ben Finney writes: > Random832 writes: > >> Ben Finney writes: >> > With the significant difference that “pointer” implies that it has its >> > own value accessible directly by the running program, such as a pointer >> > in C. >> >> Its own

Re: Python handles globals badly.

2015-09-11 Thread Random832
Mark Lawrence writes: > How do I access these pointers? Is there a builtin called pointer() > that's analogous to id()? You access them *all the time*. They are the *only* thing you access. But if you want... pointer = lambda x: return x > I'll ask again, where do pointers come into > the Jyth

Re: Python handles globals badly.

2015-09-11 Thread Random832
Mark Lawrence writes: > Let's put it another way, in the 15 years I've been using Python I do > not recall any experienced Python programmer using "pointer", so what > makes you think, in 2015, that you are correct and everybody else is > wrong? I still say that everything in Python is an object,

Re: Terminology: “reference” versus “pointer”

2015-09-11 Thread Random832
Ben Finney writes: > The reference value is inaccessible to the program, it can only be used > to get at the referenced object. That's like saying an integer is inaccessible since it can only be used to add/subtract/etc (list of all operations you can do with an integer). What does it mean to acc

Re: Terminology: “reference” versus “pointer”

2015-09-11 Thread Random832
Mark Lawrence writes: > No it isn't. When you make a copy of an object you will end up with > two names that refer to the same object. No, when you *make a copy of* an object, you get two objects. >>> x = [1, 2, 3] >>> y = copy.copy(x) >>> x is y False What you make a copy of when you do y =

Re: Python handles globals badly.

2015-09-11 Thread Random832
Chris Angelico writes: > Here. Ned Batchelder explains it better than I can. See, those diagrams are perfect (well, almost, I think the names should have square boxes too). They're arrows. They *point* at things. *Pointers*. The boxes are variables. The circles represent special boxes (implement

Are there any "correct" implementations of tzinfo?

2015-09-12 Thread Random832
I was trying to find out how arithmetic on aware datetimes is "supposed to" work, and tested with pytz. When I posted asking why it behaves this way I was told that pytz doesn't behave correctly according to the way the API was designed. The tzlocal module, on the other hand, appears to simply def

Re: Are there any "correct" implementations of tzinfo?

2015-09-12 Thread random832
On Sat, Sep 12, 2015, at 14:36, Carl Meyer wrote: > Well, the problem is that because datetime doesn't include any way to > disambiguate ambiguous times, it's not really possible to implement > complex timezones in a way that is both correct (if your definition of > correct includes "timezone conve

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-12 Thread random832
On Sat, Sep 12, 2015, at 14:53, Tim Peters wrote: > > I was trying to find out how arithmetic on aware datetimes is > > "supposed to" work, and tested with pytz. When I posted asking why > > it behaves this way I was told that pytz doesn't behave correctly > > according to the way the API was desig

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-12 Thread random832
Oops, pressed the wrong reply button and it didn't include the datetime list. On Sat, Sep 12, 2015, at 14:53, Tim Peters wrote: > > I was trying to find out how arithmetic on aware datetimes is > > "supposed to" work, and tested with pytz. When I posted asking why > > it behaves this way I was tol

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Random832
Jussi Piitulainen writes: > I think the best way is to say that a[0] and a[1] are the same object, > while b[0] and b[1] are different objects. Sure, you can *say* that. But how do you draw it on a diagram with sticky notes or parcel tags or whatever? -- https://mail.python.org/mailman/listinfo

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Random832
Akira Li <4kir4...@gmail.com> writes: >Rustom Mody writes: >> viz. I have two variables (or names!) say a and b which look the same > a >> [[1,2],[1,2]] > b >> [[1,2],[1,2]] >> And yet doing > a[0][0] = "Oops!" >> gives a data structure one "Oops!" >> whereas doing it to b mysteriously

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-13 Thread random832
On Sat, Sep 12, 2015, at 22:25, Tim Peters wrote: > That helps a lot, but "industrial-strength" implies "by algorithm". > There are far too many zones to deal with by crafting a hand-written > class for each. It occurs to me that though it's written in C, the zdump utility included in the tz cod

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-13 Thread Random832
Laura Creighton writes: > But I am not sure how it is that a poor soul who just wants to print a > railway schedule 'in local time' is supposed to know that Creighton is > using Winnipeg time. The same way they know that any other location is using whatever time it uses. By the user having specif

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Random832
Akira Li <4kir4...@gmail.com> writes: > I'm not sure what "parcel tags" model is but if you mean these > pictures[1] than it works in this case as well as any other (take *a*, > *b* nametags, put them on the corresponding balloons that represents > list objects). > > The only names left are *a* and

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Random832
On Sun, Sep 13, 2015, at 19:17, Akira Li wrote: > "do not physically exist" does not make sense. Objects are *never* > destroyed explicitly in Python (you can only make them > *unreachable*). But the objects we've talking about have never been created, because the __getitem__ method has not been c

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 04:27, Laura Creighton wrote: > I find this totally unacceptable. My conclusion was that hybrid tzinfo > objects were a _really stupid idea_ proposed by somebody who > misunderstood > the problem, or rather only understood the most common case. "Hybrid tzinfo objects" _in

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 10:48, Akira Li wrote: > start, stop, step attributes (corresponding Python ints) may not exist > ("the objects we've talking about have never been created") until you > request them explicitly. That's not true in CPython. In fact, the range object in python contains *four

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Random832
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 boxes - one more for length. > > I really don't see why any

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 13:45, Akira Li wrote: >[box + arrow pointing to] + object == parcel tag + object The problem is that if there are multiple namespaces, or if you've also got to include references from within other objects such as list, then you've got to write all that somehow on the

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 13:51, Emile van Sebille wrote: > Actually, boxes with integers in them isn't the appropriate analogy. > Consider the naming of cats. My cat is known to me as Paddy. My next > door neighbor sometimes feeds her and is known to her as Stripes. The > cat also is known

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 14:53, Tim Peters wrote: > So, on your own machine, whenever daylight time starts or ends, you > manually change your TZ environment variable to specify the newly > appropriate eternally-fixed-offset zone? Of course not. No, but the hybrid zone isn't what gets attached to

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 04:53, Laura Creighton wrote: > But this is not quite the complete story. In many (most?) places in > Saskatchewan, the rule is understood differently. Instead of 'we keep > to CST all year long' is is understood that 'we keep central time in > the winter and mountain ti

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 15:25, Alexander Belopolsky wrote: > This is a fine attitude when you implement your own brand new datetime > library. As an author of a new library you have freedoms that developers > of a 12 years old widely deployed code don't have. I'm talking about the real behavior

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 15:30, Tim Peters wrote: > You're assuming much more than POSIX - and the ISO C standard - > requirs. My description was quite explicitly about how POSIX has done > it all along. tm_gmtoff and tm_zone are extensions to the standards, > introduced (IIRC) by BSD. Portable

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 15:48, Alexander Belopolsky wrote: > On Mon, Sep 14, 2015 at 3:44 PM, Random832 > wrote: > > > It is an > > invariant that is true today, and therefore which you can't rely on any > > of the consumers of this 12 years old widely depl

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 16:01, Carl Meyer wrote: > Can we please stop cross-posting this thread to python-list and move it > to datetime-sig only? I think anyone here on python-list who is > sufficiently interested in it can subscribe to datetime-sig. > > Or the other way around, whatever. I'd ju

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 16:15, Tim Peters wrote: > [Random832 ] > > Whether or not datetimes stored tm_gmtoff and tm_zone workalikes has > no effect on semantics I can see. If, in your view, they're purely an > optimization, they're just a distraction for now. If

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 16:45, Tim Peters wrote: > Because all versions of Python expect a very specific pickle layout > for _every_ kind of pickled object (including datetimes).. Make any > change to the pickle format of any object, and older Pythons will > simply blow up (raise an exception) wh

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 17:34, Tim Peters wrote: > Yes, we "could have" done that for all pickle formats for all types. > But why on Earth would we? Pickle size is important to many apps > (e.g., Zope applications can store billions of pickles in databases. > and it may not be purely coincidence

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
On Mon, Sep 14, 2015, at 18:09, Tim Peters wrote: > Sorry, I'm not arguing about this any more. Pickle doesn't work at > all at the level of "count of bytes followed by a string". The SHORT_BINBYTES opcode consists of the byte b'C', followed by *yes indeed* "count of bytes followed by a string".

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Random832
Alexander Belopolsky writes: > No credit for anything other than the "extra credit" section. Partial > credit for that. Study that printout and you should understand what > Tim was saying. My original claim was that the pickler can't know and doesn't care if a byte string value merely happens

Re: Python handles globals badly.

2015-09-15 Thread Random832
Steven D'Aprano writes: > I don't need to see 23 printed, because I already know what the value is, so > that takes two lines where one would do. (On the rare case I did want to > see the value of something I had just assigned to, I could just print the > expression.) Of course, you could just as

Re: True == 1 weirdness

2015-09-16 Thread Random832
On Wed, Sep 16, 2015, at 09:05, Chris Angelico wrote: > My view is that they should remain in the language, but that > dissimilar comparisons should raise linter warnings. I can't imagine a > sane reason for chaining 'in' and equality like that (since the RHS of > 'in' will be a container, and if y

Re: True == 1 weirdness

2015-09-16 Thread Random832
On Wed, Sep 16, 2015, at 10:26, Chris Angelico wrote: > Quite probably never. But are there _any_ comparison operators which > are unchainable? If not, there's no reason to disallow 'in' "in" suggests a relationship between objects of different types (X and "something that can contain X") - all th

Re: True == 1 weirdness

2015-09-16 Thread Random832
On Wed, Sep 16, 2015, at 12:37, Sven R. Kunze wrote: > I like it for x < y < z. > > But I agree more than this often helps confusion more than it helps > clarity. I think that chaining should be limited to: A) all operators are "=" B) all operators are "is" C) all operators are either >= or > D)

Re: True == 1 weirdness

2015-09-16 Thread Random832
On Wed, Sep 16, 2015, at 13:24, Steven D'Aprano wrote: > On Thu, 17 Sep 2015 12:03 am, Random832 wrote: > > if word in line in text: > print("word in line and line in text") > > But I agree with Tim Chase: I wouldn't use it, even though it's lega

Re: True == 1 weirdness

2015-09-16 Thread Random832
On Wed, Sep 16, 2015, at 13:33, Steven D'Aprano wrote: > On Thu, 17 Sep 2015 01:40 am, Random832 wrote: > > > "in" suggests a relationship between objects of different types (X and > > "something that can contain X") - all the other comparison operat

Re: True == 1 weirdness

2015-09-16 Thread Random832
On Wed, Sep 16, 2015, at 13:44, Grant Edwards wrote: > Well, that case hadn't been mentioned yet. But, I agree that should be > added as case E and be allowed. That's actually what I meant by A, I just spelled it wrong. Multiple assignment isn't really the same construct as chained comparisons, I

Re: True == 1 weirdness

2015-09-16 Thread Random832
On Wed, Sep 16, 2015, at 16:38, Mark Lawrence wrote: > On 16/09/2015 18:41, Sven R. Kunze wrote: > > On 16.09.2015 19:33, Steven D'Aprano wrote: > >> And with operator overloading, < <= > and => could have any meaning you > >> like: > >> > >> graph = a => b => c <= d <= e > > > > Sorry? What are y

Re: True == 1 weirdness

2015-09-16 Thread Random832
On Wed, Sep 16, 2015, at 21:25, Steven D'Aprano wrote: > So what? The intended purpose of `is` and `==` is not to return True. It > is > to perform a comparison which may return False, or True. Yeah, but there's no point in doing a comparison unless you're doing it in a context where it *might* re

Re: True == 1 weirdness

2015-09-17 Thread Random832
On Thu, Sep 17, 2015, at 16:24, Jussi Piitulainen wrote: > And I'm saying 'in', being truth-valued, is more like a comparison than > a proper binary operation that has its value in the same set as its two > arguments. The problem is that except for very specialized cases (strings), the two argumen

Re: True == 1 weirdness

2015-09-18 Thread Random832
On Fri, Sep 18, 2015, at 08:30, Steven D'Aprano wrote: > On Fri, 18 Sep 2015 07:26 am, Random832 wrote: > > > I don't even think chaining should > > work for all *actual* comparison operations. > > I don't see why. Mathematicians chain comparisons all the

Re: True == 1 weirdness

2015-09-18 Thread Random832
On Fri, Sep 18, 2015, at 09:14, Steven D'Aprano wrote: > On Fri, 18 Sep 2015 10:47 pm, Random832 wrote: > > > On Fri, Sep 18, 2015, at 08:30, Steven D'Aprano wrote: > >> On Fri, 18 Sep 2015 07:26 am, Random832 wrote: > >> > >> > I don'

<    2   3   4   5   6   7   8   >