On Mon, Feb 16, 2015 at 7:20 PM, Cameron Simpson wrote:
> One might use exec() to use code that is valid in one python version but not
> another, when you need your program to run in both i.e. to get code that is
> syntacticly invalid in one version, but to use it (conditionally) in another
> vers
On 16Feb2015 19:10, Devin Jeanpierre wrote:
On Mon, Feb 16, 2015 at 6:15 PM, Steven D'Aprano wrote:
Here is a fork of that recipe. It uses an inner class for the new
namedtuple class. The only thing which needs exec is the __new__ method.
http://code.activestate.com/recipes/578918-yet-another
On Mon, Feb 16, 2015 at 6:15 PM, Steven D'Aprano wrote:
> Here is a fork of that recipe. It uses an inner class for the new
> namedtuple class. The only thing which needs exec is the __new__ method.
>
> http://code.activestate.com/recipes/578918-yet-another-namedtuple/
>
> This demonstrates a powe
On 02/16/2015 11:27 AM, Courtney Skinner wrote:
Hello,
I am trying to build a program that approximates the value of cosine - this is
my program so far. It is not returning the right values. Could you tell me what
I am doing wrong?
You've got several answers that point out several problems
On Mon, Feb 16, 2015 at 01:52:16PM -0600, boB Stepp wrote:
> I have heard periodically about the potential evils of using exec()
> and eval(), including today, on this list. I gather that the first
> requirement for safely using these functions is that the passed
> argument MUST be from a trusted
> Thank for the translation of the hard-to-read docs. Reading the docs threw
> me for a loop. I printed out your response and will be studying to try best
> understand it.
No problem; feel free to ask questions on anything that doesn't make
sense, and we'll try to help as best as we can.
On 02/16/2015 06:26 PM, Alan Gauld wrote:
On 16/02/15 21:26, Ken G. wrote:
I have not been able to figure out on how to use a
subprocess in place of my former popen. I have been
reading the new materials on the subprocess all day
and it is still not quite understandable.
Here is what the do
On 02/16/2015 05:11 PM, Danny Yoo wrote:
On Mon, Feb 16, 2015 at 1:26 PM, Ken G. wrote:
Wow, just found out this morning that the following
terms of:
import os
pr = os.popen("lpr", "w")
pr.write(month), pr.write(" "),
pr.write("\t\tLine ")
was deprecated. In place there of, there is
a subpro
On 16/02/15 21:26, Ken G. wrote:
I have not been able to figure out on how to use a
subprocess in place of my former popen. I have been
reading the new materials on the subprocess all day
and it is still not quite understandable.
Here is what the docs say:
###
On Mon, Feb 16, 2015 at 11:52 AM, boB Stepp wrote:
> I have heard periodically about the potential evils of using exec()
> and eval(), including today, on this list. I gather that the first
> requirement for safely using these functions is that the passed
> argument MUST be from a trusted source.
On Mon, Feb 16, 2015 at 1:26 PM, Ken G. wrote:
> Wow, just found out this morning that the following
> terms of:
>
> import os
> pr = os.popen("lpr", "w")
> pr.write(month), pr.write(" "),
> pr.write("\t\tLine ")
>
> was deprecated. In place there of, there is
> a subprocess to use.
Hi Ken,
Yes
Wow, just found out this morning that the following
terms of:
import os
pr = os.popen("lpr", "w")
pr.write(month), pr.write(" "),
pr.write("\t\tLine ")
was deprecated. In place there of, there is
a subprocess to use.
I have not been able to figure out on how to use a
subprocess in place of my f
I have heard periodically about the potential evils of using exec()
and eval(), including today, on this list. I gather that the first
requirement for safely using these functions is that the passed
argument MUST be from a trusted source. So what would be examples
where the use of these functions
Courtney Skinner wrote:
> Hello,
>
> I am trying to build a program that approximates the value of cosine -
> this is my program so far. It is not returning the right values. Could you
> tell me what I am doing wrong?
>
>
> def main():
>
> import math
>
> print("This program appro
On 16/02/15 16:27, Courtney Skinner wrote:
Hello,
I am trying to build a program that approximates the value of cosine
def main():
import math
Its usual to do the imports outside the function at the tyop of the
file. Python doesn't actually care much but its 'standard practice'.
On 16/02/2015 16:27, Courtney Skinner wrote:
Hello,
I am trying to build a program that approximates the value of cosine - this is
my program so far. It is not returning the right values. Could you tell me what
I am doing wrong?
def main():
import math
Not that it matters but imports
Hello,
I am trying to build a program that approximates the value of cosine - this is
my program so far. It is not returning the right values. Could you tell me what
I am doing wrong?
def main():
import math
print("This program approximates the cosine of x by summing")
print(
Hi Tina, or Taylor, welcome!
Sorry but your email "From" header says your name is Tina and your
signature says Taylor so I'm not sure which name you prefer.
On Sun, Feb 15, 2015 at 07:26:35PM -0600, Tina Figz wrote:
> I'm having a problem with my program and I'm not sure how to correct it
> (I'
On 16/02/2015 08:24, Alan Gauld wrote:
On 16/02/15 01:26, Tina Figz wrote:
I'm having a problem with my program and I'm not sure how to correct it
(I'm in an intro programming class).
My program is supposed two numbers and count the number of carry
operations.
This is what I have:
n1 = int(ra
On 16/02/15 01:26, Tina Figz wrote:
I'm having a problem with my program and I'm not sure how to correct it
(I'm in an intro programming class).
My program is supposed two numbers and count the number of carry
operations.
This is what I have:
n1 = int(raw_input('Number #1: '))
n2 = int(raw_inp
20 matches
Mail list logo