On 01/25/2014 04:13 AM, eryksun wrote:
On Fri, Jan 24, 2014 at 8:50 AM, spir wrote:
xs is an iterator (__next__ is there), then Python uses it directly, thus
what is the point of __iter__ there? In any case, python must check whether
Python doesn't check whether a type is already an iterator
On Fri, Jan 24, 2014 at 8:38 PM, Steven D'Aprano wrote:
>
> However, there's more to it than this. For starters, you need to decide
> on the exact behaviour. Clearly, "file not found" errors should move on
> to try the next prefix in the path list. But what about permission
> denied errors?
Prior
On Fri, Jan 24, 2014 at 10:28:09PM -0500, bob gailer wrote:
> And please call () parends and [] brackets, and{} braces. Saves a lot of
> confusion.
If you think that parentheses are spelt with a "d", you're certainly
confused :-)
They're all brackets. Often the type of bracket doesn't matter,
On 1/24/2014 4:47 AM, Steven D'Aprano wrote:
Hi Tobias, and welcome.
On Thu, Jan 23, 2014 at 07:34:18PM -0700, Tobias Quezada wrote:
hello community,i am a newbie to python and program in general.
the script below works in python 2.7.3 on windows but not in the python 2.7.3
ubuntu terminal.
On Fri, Jan 24, 2014 at 8:50 AM, spir wrote:
>
> xs is an iterator (__next__ is there), then Python uses it directly, thus
> what is the point of __iter__ there? In any case, python must check whether
Python doesn't check whether a type is already an iterator. It's
simpler to require that iterato
On Fri, Jan 24, 2014 at 04:31:49PM -0500, Keith Winston wrote:
> On Fri, Jan 24, 2014 at 4:50 AM, Steven D'Aprano wrote:
> > Python does not use a search path for the open() function, only for
> > imports. With open(), it uses a simple rule:
> >
> > - absolute paths will look only in that exact lo
Leon S Wrote in message:
> _
(please post in plain text in this text mailing list. Html messes
up formatting and causes some newsreaders grief.)
..
Leon said:
Here is what I'm trying to do, accept a price of gas, but I want
to add the .009 to the price, so that people do n
hi leon,
you made a good start and ran into something that i know doesn't seem right
to you. however, before we attack the issue, there are some basic problems
with the code you need to correct first. below are a few explanations and
perhaps workarounds:
1. you're passing in price *and* asking
maybe this would be of help
https://stackoverflow.com/questions/455612/python-limiting-floats-to-two-decimal-points
On Fri, Jan 24, 2014 at 5:57 PM, Leon S wrote:
> Here is what I'm trying to do, accept a price of gas, but I want to add
> the .009 to the price, so that people do not have to ty
Here is what I'm trying to do, accept a price of gas, but I want to add the
.009 to the price, so that people do not have to type the full amount.
Example, 3.49 /gallon would return 3.499 /gallon.
This is what I have tried and the results of it.
def gas_price(price):
price == raw_input("What
> Ah! I was just running into this... I did not know that. So there's no
> way to get it to search a path (other than coding some string
> concatenation of path names or something, of course) to open a file?
Potentially distutils.spawn.find_executable might apply,
http://docs.python.org/2/dis
On 01/24/2014 06:44 PM, Peter Otten wrote:
There is no infinite recursion. The for loop is currently implemented as
# expect an iterable
# handle iterators through an idempotent iter()
tmp = iter(xs)
# here you must check that tmp actually implements the iterator protocol,
# else raise an erro
On Fri, Jan 24, 2014 at 4:50 AM, Steven D'Aprano wrote:
> Python does not use a search path for the open() function, only for
> imports. With open(), it uses a simple rule:
>
> - absolute paths will look only in that exact location;
>
> - relative paths are always relative to the current working d
spir wrote:
> On 01/24/2014 10:22 AM, Peter Otten wrote:
>>
>> There's an odd outlier that I probably shouldn't tell you about [...]
>
> I guess there is a whole class of outliers; not really sure how to
> classify them.
I think you are focusing on the details too much. In
> class Angles:
>
On 01/24/2014 10:22 AM, Peter Otten wrote:
There's an odd outlier that I probably shouldn't tell you about [...]
I guess there is a whole class of outliers; not really sure how to classify
them. This is the case of defining a wrapper or "proxy" type, for a underlying
data structure which is
On 24/01/14 02:34, Tobias Quezada wrote:
>>>fp=open("prez.dat","r")
>>>x=fp.read
>>>(print(x)
/IOError: [Errno 2] No such file or directory: 'prez.dat'/
Python can't see your file. You can check what python
is seeing by importing os and using listdir():
import os
os.listdir(',') # . is
hello community,i am a newbie to python and program in general.
the script below works in python 2.7.3 on windows but not in the python 2.7.3
ubuntu terminal.
>>>fp=open("prez.dat","r")>>>x=fp.read>>>(print(x)***i used fp for file
>>>pointer.I am using windows 7 and it works but on ubuntu 12.04
On Fri, Jan 24, 2014 at 04:22:20AM -0500, Keith Winston wrote:
> The file would appear to not be on your search path, that is, in any
> directory in which Python is expecting to find it.
Python does not use a search path for the open() function, only for
imports. With open(), it uses a simple rul
Hi Tobias, and welcome.
On Thu, Jan 23, 2014 at 07:34:18PM -0700, Tobias Quezada wrote:
> hello community,i am a newbie to python and program in general.
> the script below works in python 2.7.3 on windows but not in the python 2.7.3
> ubuntu terminal.
>
> >>> fp=open("prez.dat","r")
> >>> x=fp.
Tobias Quezada wrote:
> hello community,i am a newbie to python and program in general.
> the script below works in python 2.7.3 on windows but not in the python
> 2.7.3 ubuntu terminal.
>
fp=open("prez.dat","r")>>>x=fp.read>>>(print(x)***i used fp for file
pointer.I am using windows 7 an
I should have mentioned, the other possibility is that the file does
not, in fact, exist, but I assume you put it out there somewhere?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/l
+--+++
| | __iter__ | __next__ |
+--+++
| iterable | return an iterator | not available |
+--+++
| i
The file would appear to not be on your search path, that is, in any
directory in which Python is expecting to find it. Either move it to a
directory on your path, or change your path to include it's location.
The easiest way to find out what your path is, that I know, is
import sys
sys.path
Good
hello community,i am a newbie to python and program in general.
the script below works in python 2.7.3 on windows but not in the python 2.7.3
ubuntu terminal.
>>>fp=open("prez.dat","r")>>>x=fp.read>>>(print(x)***i used fp for file
>>>pointer.I am using windows 7 and it works but on ubuntu 12.04
24 matches
Mail list logo