Re: Explanation of list reference

2014-02-15 Thread Ian Kelly
On Fri, Feb 14, 2014 at 11:07 PM, Rustom Mody wrote: > On Saturday, February 15, 2014 10:50:35 AM UTC+5:30, Ian wrote: >> This is false. It happens to hold for CPython, but that's an >> implementation detail. The definition of object identity does not >> depend on memory address. It also doesn'

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Ned Batchelder : > On 2/14/14 4:43 PM, Marko Rauhamaa wrote: > Yes, sometimes for teaching reasons, you have to over-simplify or even > introduce artificial constructs. I'd recommend acknowledging them as > such. > > When you say, "There are two fundamentally different kinds of values > in Python

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Feb 15, 2014 at 8:43 AM, Marko Rauhamaa wrote: >> Unfortunately neither the "everything is a reference" model nor the >> "small/big" model help you predict the value of an "is" operator in >> the ambiguous cases. > > Can you give an example of an ambiguous case? The "x

decimal numbers

2014-02-15 Thread luke . geelen
hello, i have been working on a python resistor calculator to let my class show what you can do with python. now i have a script that makes the more speekable value of the resistance (res) #if len(str(res)) > 9: # res2 = res / 10 # print "de weerstand is %s,%s giga ohms" % (res2) #elif

Re: decimal numbers

2014-02-15 Thread Luke Geelen
Op zaterdag 15 februari 2014 10:18:36 UTC+1 schreef Luke Geelen: > hello, > > i have been working on a python resistor calculator to let my class show what > you can do with python. > > now i have a script that makes the more speekable value of the resistance > (res) > > > > #if len(str(res)

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Ben Finney : > You should never need to predict the result of an ‘is’ operation. > (More precisely, for *some* cases you can predict it, but for other > cases you can't.) No problem there. You have to understand "is" well to use it. Referring to "objects in memory" when defininig "is" leads to ci

Re: Explanation of list reference

2014-02-15 Thread Christian Gollwitzer
Hi Dave, Am 14.02.14 19:08, schrieb dave em: He is asking a question I am having trouble answering which is how a variable containing a value differs from a variable containing a list or more specifically a list reference. as others have explained better and in more detail, there are mutable

Re: Explanation of list reference

2014-02-15 Thread Christian Gollwitzer
Am 15.02.14 01:57, schrieb Chris Angelico: Can you give an example of an ambiguous case? Fundamentally, the 'is' operator tells you whether its two operands are exactly the same object, nothing more and nothing less, so I assume your "ambiguous cases" are ones where it's possible for two things t

Re: decimal numbers

2014-02-15 Thread Frank Millman
"Luke Geelen" wrote in message news:ec88852e-1384-4aa5-834b-85135be94...@googlegroups.com... > Op zaterdag 15 februari 2014 10:18:36 UTC+1 schreef Luke Geelen: > hello, > > i have been working on a python resistor calculator to let my class show > what you can do with python. > > now i have a s

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Christian Gollwitzer : > Still they are connected. I can imagin that id() is just a debugging > tool for extensions. What useful applications does it have outside of > this? Calculating hash keys quickly. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: decimal numbers

2014-02-15 Thread Chris Angelico
On Sat, Feb 15, 2014 at 9:04 PM, Frank Millman wrote: > If you are using python2, an integer divided by an integer always returns an > integer - > 10/3 > 3 > > It was changed in python3 to return a float - > 10/3 > 3.3335 > > You can reproduce the python3 behaviour in python2

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Marko Rauhamaa : > 1. if x is y then y ix x > 2. if x is y and y is z then x is z > 3. after x = y, x is y > 4. if x is y, then x == y A new attempt: 0. x is x 1. if x is y then y ix x 2. if x is y and y is z then x is z 3. after x = y, x is y 4. if x is y and x == x, then

Re: Explanation of list reference

2014-02-15 Thread Steven D'Aprano
On Sat, 15 Feb 2014 11:10:46 +0200, Marko Rauhamaa wrote: > Chris Angelico : > >> On Sat, Feb 15, 2014 at 8:43 AM, Marko Rauhamaa >> wrote: >>> Unfortunately neither the "everything is a reference" model nor the >>> "small/big" model help you predict the value of an "is" operator in >>> the ambi

Re: decimal numbers

2014-02-15 Thread Luke Geelen
Op zaterdag 15 februari 2014 11:04:17 UTC+1 schreef Frank Millman: > "Luke Geelen" wrote in message > > news:ec88852e-1384-4aa5-834b-85135be94...@googlegroups.com... > > > Op zaterdag 15 februari 2014 10:18:36 UTC+1 schreef Luke Geelen: > > > hello, > > > > > > i have been working on a pytho

Re: Explanation of list reference

2014-02-15 Thread Steven D'Aprano
On Sat, 15 Feb 2014 11:31:42 +0200, Marko Rauhamaa wrote: > It think the best way to define the semantics of "is" is > through constraints: > > 1. if x is y then y ix x > > 2. if x is y and y is z then x is z > > 3. after x = y, x is y > > 4. if x is y, then x == y Incorrect. py> x

Re: decimal numbers

2014-02-15 Thread Frank Millman
"Luke Geelen" wrote in message news:ae0da085-6c41-4166-92d2-92611a990...@googlegroups.com... > Op zaterdag 15 februari 2014 11:04:17 UTC+1 schreef Frank Millman: >> "Luke Geelen" wrote in message >> >> news:ec88852e-1384-4aa5-834b-85135be94...@googlegroups.com... >> [...] >> >> You can reproduc

Re: Explanation of list reference

2014-02-15 Thread Steven D'Aprano
On Sat, 15 Feb 2014 10:44:39 +0100, Christian Gollwitzer wrote: > Am 15.02.14 01:57, schrieb Chris Angelico: >> Can you give an example of an ambiguous case? Fundamentally, the 'is' >> operator tells you whether its two operands are exactly the same >> object, nothing more and nothing less, so I a

Re: decimal numbers

2014-02-15 Thread Frank Millman
"Frank Millman" wrote in message news:ldngnf$c3r$1...@ger.gmane.org... > > "Luke Geelen" wrote in message > news:ae0da085-6c41-4166-92d2-92611a990...@googlegroups.com... >> Op zaterdag 15 februari 2014 11:04:17 UTC+1 schreef Frank Millman: >>> "Luke Geelen" wrote in message >>> >>> news:ec888

Re: Generator using item[n-1] + item[n] memory

2014-02-15 Thread Steven D'Aprano
On Fri, 14 Feb 2014 22:21:11 -0500, Roy Smith used a generator: > print g1.next() Roy, unless you're stuck with Python 2.5 (or older!), you ought to use the built-in function next(g1) rather than directly call the next method. Not only is this the recommended way to do it, but it's also more fu

Re: Explanation of list reference

2014-02-15 Thread Chris Angelico
On Sat, Feb 15, 2014 at 8:31 PM, Marko Rauhamaa wrote: > Referring to "objects in memory" when defininig "is" leads to circular > definitions. It think the best way to define the semantics of "is" is > through constraints: > > 1. if x is y then y ix x > > 2. if x is y and y is z then x is z >

Re: Explanation of list reference

2014-02-15 Thread Steven D'Aprano
On Sat, 15 Feb 2014 12:13:54 +0200, Marko Rauhamaa wrote: > Marko Rauhamaa : > >> 1. if x is y then y ix x >> 2. if x is y and y is z then x is z >> 3. after x = y, x is y >> 4. if x is y, then x == y > > A new attempt: > >0. x is x >1. if x is y then y ix x >2. if x is y an

Re: Explanation of list reference

2014-02-15 Thread Chris Angelico
On Sat, Feb 15, 2014 at 8:44 PM, Christian Gollwitzer wrote: import numpy as np a=np.array([1, 2, 3, 4]) b=a[:] id(a) > 140267900969344 id(b) > 140267901045920 > > So, a and b are different things, right? > b[1]=37 b > array([ 1, 37, 3, 4]) a > array([ 1,

Re: Install python 2 and 3 in the "wrong" order

2014-02-15 Thread Nagy László Zsolt
From a cmd window: ftype python.file="C:\Windows\py.exe" "%1" %* ftype python.noconfile="C:\Windows\pyw.exe" "%1" %* There is a serious problem with this! Example code test.py: #!/usr/bin/env python3 import sys print(sys.argv) Test run: C:\Temp>test.py 1 2 3 ['C:\\Temp\\test.py'] This is

Re: Generator using item[n-1] + item[n] memory

2014-02-15 Thread Peter Otten
Chris Angelico wrote: > On Sat, Feb 15, 2014 at 6:27 PM, Ian Kelly wrote: >> On Fri, Feb 14, 2014 at 8:31 PM, Nick Timkovich >> wrote: >>> OK, now the trick; adding `data = None` inside the generator works, but >>> in my actual code I wrap my generator inside of `enumerate()`, which >>> seems to

Re: Explanation of list reference

2014-02-15 Thread Gregory Ewing
Steven D'Aprano wrote: (1) General relativity tells us that not all observers will agree on the space-time coordinates of two objects, since not all observers agree on a single frame of reference. But that doesn't mean they won't agree about whether objects are identical or not! The coordinate

Re: Explanation of list reference

2014-02-15 Thread Chris Angelico
On Sat, Feb 15, 2014 at 9:13 PM, Marko Rauhamaa wrote: > A new attempt: Sorry, hadn't seen this when I posted. >0. x is x This is the definition of identity. >1. if x is y then y ix x Yes, because if x is y, there is absolutely no difference between using one of those names or the oth

Re: Explanation of list reference

2014-02-15 Thread Gregory Ewing
Steven D'Aprano wrote: IDs are a proxy for distinct objects. If you live in a country with an ID card of some sort, then the IDs acts as an identifier for each unique individual. But countries without ID cards don't lack unique individual people. "You are Number Six." "I am not an id()! I am

Re: Install python 2 and 3 in the "wrong" order

2014-02-15 Thread Chris Angelico
On Sat, Feb 15, 2014 at 10:25 PM, Nagy László Zsolt wrote: >> From a cmd window: >> >> ftype python.file="C:\Windows\py.exe" "%1" %* >> >> ftype python.noconfile="C:\Windows\pyw.exe" "%1" %* > > There is a serious problem with this! Example code test.py: > > #!/usr/bin/env python3 > import sys >

Re: Explanation of list reference

2014-02-15 Thread Chris Angelico
On Sat, Feb 15, 2014 at 10:32 PM, Gregory Ewing wrote: > Steven D'Aprano wrote: >> >> IDs are a proxy for distinct objects. If you live in a country with an ID >> card of some sort, then the IDs acts as an identifier for each unique >> individual. But countries without ID cards don't lack unique i

ipython

2014-02-15 Thread greymausg
using IPython, is there any way of recording the commands I have entered? -- maus . . ... -- https://mail.python.org/mailman/listinfo/python-list

Re: Explanation of list reference

2014-02-15 Thread Gregory Ewing
Jussi Piitulainen wrote: Would it help to say that in case 1 the relevant statement acts on the variable while in case 2 it acts on the value of the variable? I would try to avoid using words like "value" and "variable", because they don't have well-defined meanings in Python. The way I would

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Steven D'Aprano : > On Sat, 15 Feb 2014 12:13:54 +0200, Marko Rauhamaa wrote: >>0. x is x >>1. if x is y then y ix x >>2. if x is y and y is z then x is z >>3. after x = y, x is y >>4. if x is y and x == x, then x == y >>5. id(x) == id(y) iff x is y > > # Counter-example >

Re: Explanation of list reference

2014-02-15 Thread Gregory Ewing
Chris Angelico wrote: But yes, this is an expression, and it evaluates to a reference. Well, *all* expressions in Python evaluate to references, so that's not really saying much. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Explanation of list reference

2014-02-15 Thread Ben Finney
Jussi Piitulainen writes: > In cheese = spam, cheese is the variable while spam is a variable > reference and stands for 42. Oof. This distinction between “variable” and “variable reference” is bogus and unnecessary, and highlights what is wrong with talking about “variable” at all. In the Pyth

Re: Explanation of list reference

2014-02-15 Thread Chris Angelico
On Sat, Feb 15, 2014 at 11:18 PM, Gregory Ewing wrote: > Chris Angelico wrote: >> >> But yes, this is an expression, and it evaluates to a reference. > > > Well, *all* expressions in Python evaluate to references, > so that's not really saying much. Because everything in Python is an object, and

Re: ipython

2014-02-15 Thread Mark Lawrence
On 15/02/2014 11:55, greymausg wrote: using IPython, is there any way of recording the commands I have entered? I believe ipython automatically stores the commands you enter. Searching for ipython+command+history should get you more detail than I can offer :) -- My fellow Pythonistas, ask

Re: Generator using item[n-1] + item[n] memory

2014-02-15 Thread Mark Lawrence
On 15/02/2014 03:31, Nick Timkovich wrote: OK, now the trick; adding `data = None` inside the generator works, but in my actual code I wrap my generator inside of `enumerate()`, which seems to obviate the "fix". Can I get it to play nice or am I forced to count manually. Is that a feature? On

Re: Explanation of list reference

2014-02-15 Thread Mark Lawrence
On 15/02/2014 06:07, Rustom Mody wrote: Then you are obliged to provide some other way of understanding object-identity I have no interest in understanding object identity, I can write code quite happily without it. If you (plural) are interested in understanding this subject I hope you enjo

Re:ipython

2014-02-15 Thread Dave Angel
greymausg Wrote in message: > using IPython, is there any way of recording the commands I have entered? > Try the history command. http://ipython.org/ipython-doc/rel-1.1.0/api/generated/IPython. core.magics.history.html -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Chris Angelico : > Because everything in Python is an object, and objects always are > handled by their references. This wouldn't be true in every language > (eg it's not true of Java's unboxed types), but it's intrinsic to > Python's object model. Well, it's part of Python's reference model. Any

[Q] Beaker 1.6.4 not work on Python3

2014-02-15 Thread Makoto Kuwata
Hi, Does Beaker 1.6.4 work on Python3 ? Is there anyone using Beaker on Python3? I got the following error on Python 3.3: File "/opt/lang/python/3.2.2/lib/python3.2/http/cookies.py", line 486, in __setitem__ rval, cval = self.value_encode(value) File "/opt/lang/python/3.2.2/lib/python3

Re: [RELEASED] Python 3.3.4

2014-02-15 Thread Makoto Kuwata
Congrat! By the way, I can't find Python-3.3.4.tar.bz2 in: http://www.python.org/ftp/python/3.3.4/ Python-3.3.{1,2,3}.tar.bz2 and Python-3.4.0.tar.bz2 are provided, but Python-3.3.4.tar.bz2 is not. Why? # I hope that Python-3.3.4.tar.bz2 is also provided. -- regards, makoto kuwata On Tue, Feb

Re: Install python 2 and 3 in the "wrong" order

2014-02-15 Thread Nagy László Zsolt
Just because I have a distrust of Windows's command interpreter, what happens when you type: ftype python.file ? Does it echo back what you thought it had, or has %* been eaten? If the %* is missing, that would explain the loss of arguments. Already tought of that: C:\Temp>ftype python.fil

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Mark Lawrence : > I have no interest in understanding object identity, I can write code > quite happily without it. Luckily, what we are now debating is mostly terminology and points of view where the outcomes are unaffected. However, as an example, it is important to know if you should write:

Re: ipython

2014-02-15 Thread greymausg
On 2014-02-15, Mark Lawrence wrote: > On 15/02/2014 11:55, greymausg wrote: >> using IPython, is there any way of recording the commands I have entered? >> > > I believe ipython automatically stores the commands you enter. > Searching for ipython+command+history should get you more detail than I

Re: Explanation of list reference

2014-02-15 Thread Ben Finney
Marko Rauhamaa writes: > Anyway, an object is a fairly advanced and abstract concept. It is a concept that, in natural language, has the huge advantage of producing correct inferences most of the time. You don't need to give a formal definition when first introducing the term “object”. Just use

Re: How to turn a package into something pip can install

2014-02-15 Thread Chris “Kwpolska” Warrick
On Sat, Feb 15, 2014 at 3:26 AM, Roy Smith wrote: > In article , > Ryan Gonzalez wrote: > >> python setup.py sdist > > OK, I run that and I get a metar-1.4.0.tar.gz under dist. If I move > that tarfile to my packages directory, and run pip, I get: > > $ pip install --no-index --quiet --find-lin

Re: Localized Type Inference of Atomic Types in Python

2014-02-15 Thread anand
On Wednesday, May 25, 2005 4:41:34 AM UTC+5:30, Brett C. wrote: > My thesis, "Localized Type Inference of Atomic Types in Python", was > successfully defended today for my MS in Computer Science at the California > Polytechnic State University, San Luis Obispo. With that stamp of approval I > am r

Re: Explanation of list reference

2014-02-15 Thread Ben Finney
Joshua Landau writes: > Here, I give you a pdf. Hopefully this isn't anti > mailing-list-etiquette. This forum is read in many different contexts, and attachments aren't appropriate. You should simply put the text directly into your message, if it's short enough. If it's long, then put it onlin

Re: Localized Type Inference of Atomic Types in Python

2014-02-15 Thread Chris Angelico
On Sun, Feb 16, 2014 at 1:13 AM, wrote: > On Wednesday, May 25, 2005 4:41:34 AM UTC+5:30, Brett C. wrote: >> My thesis, "Localized Type Inference of Atomic Types in Python", was >> successfully defended today for my MS in Computer Science at the California >> Polytechnic State University, San Lui

Re: Explanation of list reference

2014-02-15 Thread Chris Angelico
On Sun, Feb 16, 2014 at 1:20 AM, Ben Finney wrote: > Joshua Landau writes: > >> Here, I give you a pdf. Hopefully this isn't anti >> mailing-list-etiquette. > > This forum is read in many different contexts, and attachments aren't > appropriate. You should simply put the text directly into your m

Re: Localized Type Inference of Atomic Types in Python

2014-02-15 Thread Mark Lawrence
On 15/02/2014 14:13, an...@chatimity.com wrote: On Wednesday, May 25, 2005 4:41:34 AM UTC+5:30, Brett C. wrote: My thesis, "Localized Type Inference of Atomic Types in Python", was successfully defended today for my MS in Computer Science at the California Polytechnic State University, San Luis

Re: Explanation of list reference

2014-02-15 Thread Steven D'Aprano
On Sat, 15 Feb 2014 14:07:35 +0200, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Sat, 15 Feb 2014 12:13:54 +0200, Marko Rauhamaa wrote: >>>0. x is x >>>1. if x is y then y ix x >>>2. if x is y and y is z then x is z >>>3. after x = y, x is y >>>4. if x is y and x == x, th

Re: ipython

2014-02-15 Thread Peter Otten
greymausg wrote: > using IPython, is there any way of recording the commands I have entered? Did you ever enter ? in ipython? In [1]: a = float(raw_input("a? ")) a? 1 In [2]: b = float(raw_input("b? ")) b? 2 In [3]: ab = a + b In [4]: c = ab*ab In [5]: print c 9.0 In [6]: In[1:3] Out[6]:

Re: decimal numbers

2014-02-15 Thread Laurent Pointal
luke.gee...@gmail.com wrote: > hello, > i have been working on a python resistor calculator to let my class show > what you can do with python. now i have a script that makes the more > speekable value of the resistance (res) > > #if len(str(res)) > 9: > # res2 = res / 10 > # print "de

Re: ipython

2014-02-15 Thread greymausg
On 2014-02-15, greymausg wrote: > On 2014-02-15, Mark Lawrence wrote: >> On 15/02/2014 11:55, greymausg wrote: >>> using IPython, is there any way of recording the commands I have entered? >>> >> >> I believe ipython automatically stores the commands you enter. >> Searching for ipython+command+h

Absolute imports?

2014-02-15 Thread Roy Smith
http://docs.python.org/2/whatsnew/2.5.html says: "Once absolute imports are the default, import string will always find the standard library¹s version." Experimentally, it appears that modules in site-packages are also found by absolute imports. I wouldn't consider site-packages to be part of

Re: Absolute imports?

2014-02-15 Thread Chris Angelico
On Sun, Feb 16, 2014 at 2:06 AM, Roy Smith wrote: > It also says, "This absolute-import behaviour will become the default in > a future version (probably Python 2.7)", but it appears that 2.7.6 is > still doing relative by default. > Since absolute imports can be controlled with a future directiv

Quick Help

2014-02-15 Thread kjakupak
Just need a bit of help understanding this so I can actually start it. The input to a program will come from a file called "asdf.in". This file will have all the info needed for the course. The formatting of the input file is described as follows, with denoting # of white spaces and denoting

Re: Question on using FP numbers in python 2

2014-02-15 Thread Steven D'Aprano
On Sat, 15 Feb 2014 00:07:49 -0500, Gene Heskett wrote: >> Can you extract the float calculations and show us, together with some >> sample data, expected result, and actual result? > > Not extract, but let you get & look at the code, its the top entry on > this page: > >

Re: Absolute imports?

2014-02-15 Thread Peter Otten
Roy Smith wrote: > http://docs.python.org/2/whatsnew/2.5.html says: > > "Once absolute imports are the default, import string will always find > the standard library¹s version." > > Experimentally, it appears that modules in site-packages are also found > by absolute imports. I wouldn't conside

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Steven D'Aprano : > On Sat, 15 Feb 2014 14:07:35 +0200, Marko Rauhamaa wrote: >> Steven D'Aprano : >>> On Sat, 15 Feb 2014 12:13:54 +0200, Marko Rauhamaa wrote: 5. id(x) == id(y) iff x is y >>> >>> # Counter-example >>> py> x = 23 >>> py> idx = id(x) >>> py> del x >>> py> y = 42 >>>

Re: Quick Help

2014-02-15 Thread Gary Herron
On 02/15/2014 07:27 AM, kjaku...@gmail.com wrote: Just need a bit of help understanding this so I can actually start it. The input to a program will come from a file called "asdf.in". This file will have all the info needed for the course. The formatting of the input file is described as follow

Re: Explanation of list reference

2014-02-15 Thread Roy Smith
Steven D'Aprano : > > Object identity is simple and well-defined in Python. I don't know why > > you are so resistant to this. Read the documentation. Marko Rauhamaa : > It is not defined at all: > >Every object has an identity, a type and a value. An object’s >identity never changes on

inheriting a large python code base

2014-02-15 Thread Rita
hi all, i just inherited a large python code base and I would like to optimize the code (run faster). The application is a scientific application so I really don't understand the internal logic. Here is what I have done so far, profile (cProfile) and was able to see where the code was taking the

Re: Explanation of list reference

2014-02-15 Thread Ian Kelly
On Sat, Feb 15, 2014 at 9:29 AM, Marko Rauhamaa wrote: > Steven D'Aprano : >> On Sat, 15 Feb 2014 14:07:35 +0200, Marko Rauhamaa wrote: >>> Steven D'Aprano : On Sat, 15 Feb 2014 12:13:54 +0200, Marko Rauhamaa wrote: >5. id(x) == id(y) iff x is y # Counter-example py> x

Re: decimal numbers

2014-02-15 Thread Luke Geelen
If i do set form thing in my script i get Invalide syntax pointing at the last word of the form rule -- https://mail.python.org/mailman/listinfo/python-list

Re: decimal numbers

2014-02-15 Thread Ian Kelly
On Sat, Feb 15, 2014 at 2:18 AM, wrote: > hello, > i have been working on a python resistor calculator to let my class show what > you can do with python. > now i have a script that makes the more speekable value of the resistance > (res) > > #if len(str(res)) > 9: > # res2 = res / 10

Re: decimal numbers

2014-02-15 Thread Ian Kelly
On Sat, Feb 15, 2014 at 10:17 AM, Luke Geelen wrote: > If i do set form thing in my script i get > Invalide syntax pointing at the last word of the form rule Please copy and paste the exact code you ran along with the full text of the exception into your post. Paraphrasing it like this doesn't h

Re: Question on using FP numbers in python 2

2014-02-15 Thread Gene Heskett
On Saturday 15 February 2014 12:13:42 Steven D'Aprano did opine: > On Sat, 15 Feb 2014 00:07:49 -0500, Gene Heskett wrote: > >> Can you extract the float calculations and show us, together with > >> some sample data, expected result, and actual result? > > > > Not extract, but let you get & look

Re: Explanation of list reference

2014-02-15 Thread Rustom Mody
On Saturday, February 15, 2014 10:32:39 PM UTC+5:30, Roy Smith wrote: > Steven D'Aprano : > > > Object identity is simple and well-defined in Python. I don't know why > > > you are so resistant to this. Read the documentation. > Marko Rauhamaa > > It is not defined at all: > >Every object has

Re: decimal numbers

2014-02-15 Thread Luke Geelen
Op zaterdag 15 februari 2014 18:23:20 UTC+1 schreef Ian: > On Sat, Feb 15, 2014 at 10:17 AM, Luke Geelen wrote: > > > If i do set form thing in my script i get > > > Invalide syntax pointing at the last word of the form rule > > > > Please copy and paste the exact code you ran along with the

Re: Explanation of list reference

2014-02-15 Thread Rustom Mody
On Saturday, February 15, 2014 9:59:59 PM UTC+5:30, Marko Rauhamaa wrote: > Steven D'Aprano: > > Object identity is simple and well-defined in Python. I don't know why > > you are so resistant to this. Read the documentation. > It is not defined at all: In a certain way thats what I am saying. Bu

Re: inheriting a large python code base

2014-02-15 Thread Mark Lawrence
On 15/02/2014 17:10, Rita wrote: hi all, i just inherited a large python code base and I would like to optimize the code (run faster). The application is a scientific application so I really don't understand the internal logic. Here is what I have done so far, profile (cProfile) and was able to

Re: inheriting a large python code base

2014-02-15 Thread Ray Cote
Hi Rita: Some personal thoughts on how I've approached similar situations: Step 0: Put all that code under version control immediately. Being able to track and back-out changes is extremely useful -- even in a small, single-coder app. With something this big, you'll find "things suddenly stop

Re: Problem importing libraries installed with PIP in Eclipse

2014-02-15 Thread Fabio Zadrozny
On Fri, Feb 14, 2014 at 1:30 AM, Renato wrote: > Hi guys, I'm using Python 2.7.5 64 bits and I have a problem when > importing libraries that were installed via PIP when importing them inside > Eclipse (version 4.3.1). Outside Eclipse (directly in Python's shell) > everything works fine, here is

Re: Explanation of list reference

2014-02-15 Thread Ian Kelly
On Sat, Feb 15, 2014 at 10:30 AM, Rustom Mody wrote: > Thanks! -- Nice to hear slightly more philosophically astute attempt than > the naivete going around: "Object?! We all know whats an object! > Everyone knows whats an object!!" > > However I am betting that the problem remains. Youve transfere

Re: Explanation of list reference

2014-02-15 Thread Ian Kelly
On Sat, Feb 15, 2014 at 11:37 AM, Ian Kelly wrote: > But what is a set? Cantor offers this definition: > > """ > A set is a gathering together into a whole of definite, distinct > objects of our perception [Anschauung] or of our thought - which are > called elements of the set. > """ > > But what

Re: decimal numbers

2014-02-15 Thread Luke Geelen
Op zaterdag 15 februari 2014 18:42:51 UTC+1 schreef Luke Geelen: > Op zaterdag 15 februari 2014 18:23:20 UTC+1 schreef Ian: > > > On Sat, Feb 15, 2014 at 10:17 AM, Luke Geelen wrote: > > > > > > > If i do set form thing in my script i get > > > > > > > Invalide syntax pointing at the last w

Re: Explanation of list reference

2014-02-15 Thread Grant Edwards
On 2014-02-15, Chris Angelico wrote: > On Sat, Feb 15, 2014 at 4:20 PM, Ian Kelly wrote: >> On Fri, Feb 14, 2014 at 9:24 PM, Rustom Mody wrote: >>> To start with we say two objects are identical if they have the same >>> memory address. >> >> This is false. It happens to hold for CPython, but t

Re: decimal numbers

2014-02-15 Thread Mark Lawrence
On 15/02/2014 18:57, Luke Geelen wrote: Op zaterdag 15 februari 2014 18:42:51 UTC+1 schreef Luke Geelen: Op zaterdag 15 februari 2014 18:23:20 UTC+1 schreef Ian: On Sat, Feb 15, 2014 at 10:17 AM, Luke Geelen wrote: If i do set form thing in my script i get Invalide syntax pointi

Re: Explanation of list reference

2014-02-15 Thread Steven D'Aprano
On Sat, 15 Feb 2014 12:02:39 -0500, Roy Smith wrote: > Steven D'Aprano : >> > Object identity is simple and well-defined in Python. I don't know >> > why you are so resistant to this. Read the documentation. > > Marko Rauhamaa : >> It is not defined at all: >> >>Every object has an identity,

Re: Explanation of list reference

2014-02-15 Thread Steven D'Aprano
On Sat, 15 Feb 2014 18:29:59 +0200, Marko Rauhamaa wrote: > Steven D'Aprano : >> On Sat, 15 Feb 2014 14:07:35 +0200, Marko Rauhamaa wrote: >>> Steven D'Aprano : On Sat, 15 Feb 2014 12:13:54 +0200, Marko Rauhamaa wrote: >5. id(x) == id(y) iff x is y # Counter-example py>

Re: decimal numbers

2014-02-15 Thread Steven D'Aprano
On Sat, 15 Feb 2014 10:57:20 -0800, Luke Geelen wrote: > hey, is it possible to remove the .0 if it is a valua without something > behind the poit (like 5.0 gets 5 but 9.9 stays 9.9 Yes, but not easily. First, check the number's fractional part, and if it is zero, convert it to an int: # Here,

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Ian Kelly : > On Sat, Feb 15, 2014 at 9:29 AM, Marko Rauhamaa wrote: >> Thus "x and y are identical" *means* "x is y" and nothing else. > > This notion of identity sounds useless, and if that is the way you > prefer to understand it then you can safely ignore that it exists. I > think that most u

Re: Explanation of list reference

2014-02-15 Thread Terry Reedy
On 2/15/2014 1:07 AM, Rustom Mody wrote: On Saturday, February 15, 2014 10:50:35 AM UTC+5:30, Ian wrote: On Fri, Feb 14, 2014 at 9:24 PM, Rustom Mody wrote: In the case of physical objects like dice there is a fairly unquestionable framing that makes identity straightforward -- 4-dimensional s

Re: Explanation of list reference

2014-02-15 Thread Joshua Landau
On 15 February 2014 14:20, Ben Finney wrote: > Joshua Landau writes: > >> Here, I give you a pdf. Hopefully this isn't anti >> mailing-list-etiquette. > > This forum is read in many different contexts, and attachments aren't > appropriate. You should simply put the text directly into your message

Re: Explanation of list reference

2014-02-15 Thread Marko Rauhamaa
Steven D'Aprano : > On Sat, 15 Feb 2014 18:29:59 +0200, Marko Rauhamaa wrote: >> Nowhere do I see the violating "x is y". > > Do you truly think that there is even the tiniest, most microscopic > chance that the int 23 which has been garbage-collected and no > longer exists, and the int 42

Re: Emacs python-mode.el bug #1207470

2014-02-15 Thread Frank Stutzman
This has been resolved and I want to publically thank Andreas for finding and fixing this bug so quick. I'm fairly new to open source development and the rapidity that this was fix was gratifying. -- Frank Stutzman -- https://mail.python.org/mailman/listinfo/python-list

Re: Explanation of list reference

2014-02-15 Thread Ian Kelly
On Sat, Feb 15, 2014 at 1:20 PM, Marko Rauhamaa wrote: > Ian Kelly : > >> On Sat, Feb 15, 2014 at 9:29 AM, Marko Rauhamaa wrote: >>> Thus "x and y are identical" *means* "x is y" and nothing else. >> >> This notion of identity sounds useless, and if that is the way you >> prefer to understand it

Re: decimal numbers

2014-02-15 Thread Ian Kelly
On Sat, Feb 15, 2014 at 11:57 AM, Luke Geelen wrote: > hey, is it possible to remove the .0 if it is a valua without something > behind the poit (like 5.0 gets 5 but 9.9 stays 9.9 The ':g' format specifier will trim off trailing zeroes, e.g.: >>> '{:g}'.format(5.0) '5' It also switches to expo

Re: How to turn a package into something pip can install

2014-02-15 Thread Roy Smith
In article , Chris “Kwpolska” Warrick wrote: > On Sat, Feb 15, 2014 at 3:26 AM, Roy Smith wrote: > > In article , > > Ryan Gonzalez wrote: > > > >> python setup.py sdist > > > > OK, I run that and I get a metar-1.4.0.tar.gz under dist. If I move > > that tarfile to my packages directory,

passing an option to the python interpreter

2014-02-15 Thread Jabba Laci
Hi, The first line in my scripts looks like this: #!/usr/bin/env python I would like to use unbuffered output in a script, which can be done with the -u option, thus I tried this: #!/usr/bin/env python -u But if I want to run it from the command line ($ ./unbuffered.py), I get this error: /us

Re: How to turn a package into something pip can install

2014-02-15 Thread Roy Smith
In article , Roy Smith wrote: > > > $ pip install --no-index --quiet --find-links packages metar==1.4.0 > > [snip] > > > ValueError: unknown url type: packages > > > > The path to your cache directory is incorrect. I suggest using > > absolute paths (eg. /home/user/packages) instead of relativ

Re: passing an option to the python interpreter

2014-02-15 Thread Marko Rauhamaa
Jabba Laci : > I tried this: > > #!/usr/bin/env python -u The hash-bang notation is quite rigid; it only accepts a single argument ("python") to the command ("/usr/bin/env"). I don't know if there is a simple workaround. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: passing an option to the python interpreter

2014-02-15 Thread Chris Angelico
On Sun, Feb 16, 2014 at 9:32 AM, Jabba Laci wrote: > #!/usr/bin/env python -u > > But if I want to run it from the command line ($ ./unbuffered.py), I > get this error: > > /usr/bin/env: python -u: No such file or directory > > env is looking for "python -u" but such a command doesn't exist. > > H

Re: Explanation of list reference

2014-02-15 Thread Chris Angelico
On Sun, Feb 16, 2014 at 7:44 AM, Joshua Landau wrote: > On 15 February 2014 14:20, Ben Finney wrote: >> Joshua Landau writes: >> >>> Here, I give you a pdf. Hopefully this isn't anti >>> mailing-list-etiquette. >> >> This forum is read in many different contexts, and attachments aren't >> approp

Re: inheriting a large python code base

2014-02-15 Thread Cameron Simpson
On 15Feb2014 12:10, Rita wrote: > i just inherited a large python code base and I would like to optimize the > code (run faster). The application is a scientific application so I really > don't understand the internal logic. [...] One thing I would keep in mind is that scientific applications gen

Re: [RELEASED] Python 3.3.4

2014-02-15 Thread Ned Deily
In article , Makoto Kuwata wrote: > By the way, I can't find Python-3.3.4.tar.bz2 in: > http://www.python.org/ftp/python/3.3.4/ > > Python-3.3.{1,2,3}.tar.bz2 and Python-3.4.0.tar.bz2 are provided, > but Python-3.3.4.tar.bz2 is not. Why? > # I hope that Python-3.3.4.tar.bz2 is also provided. T

Re: Quick Help

2014-02-15 Thread Cameron Simpson
On 15Feb2014 07:27, kjaku...@gmail.com wrote: > Just need a bit of help understanding this so I can actually start it. > > The input to a program will come from a file called "asdf.in". This file will > have all the info needed for the course. The formatting of the input file is > described as

  1   2   >