On 31/08/12 05:43, Steven D'Aprano wrote:
Where does the name come from? Lambda is the Greek letter L,
and for reasons I don't know, it is the traditional name used
for functions in some of the more abstract areas of computer
science.
More specifically it is the name of a branch of mathematics
On 31/08/12 00:32, Ashley Fowler wrote:
This is a problem using the Scheme programming...Can anybody help me
with this problem?
2. Write a procedure (sphere r) that takes the radius of a sphere
as the value of its input parameter and returns the volume of that
sphere given by the formula: (4/3)π
On 31/08/12 02:12, Ashley Fowler wrote:
Can anyone help me edit this code below to return the list in the form
of a column instead of a row?
def printList():
list1 = input("Insert a list")
list = [list1]
print (list)
First you need to convert the string that your user types into
On 31/08/2012 04:27, William R. Wing (Bill Wing) wrote:
How about -
for item in iter(list):
….print item
Overengineering? :) A list is an iterator.
-Bill
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http
Friends,
I use the following way to check for the input parameters. I would
like to know if there is a any better way to show or describe the
script usage. So when the user just runs it without any input params.,
the program shd not execute but just shows the documentation.
from sys import argv
if
On 31/08/2012 08:55, Alan Gauld wrote:
Now just translate that into Scheme :-)
HTH
Anyone know of an application to automate Python to Scheme translation? :)
--
Cheers.
Mark Lawrence.
___
Tutor maillist - Tutor@python.org
To unsubscribe or cha
That's left as an exercise to the reader.
On Friday, August 31, 2012, Mark Lawrence wrote:
> On 31/08/2012 08:55, Alan Gauld wrote:
>
>>
>> Now just translate that into Scheme :-)
>>
>> HTH
>>
>>
> Anyone know of an application to automate Python to Scheme translation? :)
>
> --
> Cheers.
>
> Mar
Bala subramanian wrote:
> I use the following way to check for the input parameters. I would
> like to know if there is a any better way to show or describe the
> script usage. So when the user just runs it without any input params.,
> the program shd not execute but just shows the documentation.
On 31/08/2012 09:44, Kal Sze wrote:
That's left as an exercise to the reader.
On Friday, August 31, 2012, Mark Lawrence wrote:
On 31/08/2012 08:55, Alan Gauld wrote:
Now just translate that into Scheme :-)
HTH
Anyone know of an application to automate Python to Scheme translation? :)
-
On 31/08/12 19:13, Mark Lawrence wrote:
[...]
Please don't top post.
And Mark, please trim your replies. Bottom posting without trimming is
just as annoying as top posting without trimming.
(Among other things, your post ended up containing THREE copies of the
mailing list footer.)
--
Steve
On 31/08/2012 12:51, Steven D'Aprano wrote:
On 31/08/12 19:13, Mark Lawrence wrote:
[...]
Please don't top post.
And Mark, please trim your replies. Bottom posting without trimming is
just as annoying as top posting without trimming.
(Among other things, your post ended up containing THREE co
Please always respond to the list. And avoid top posting.
> -Original Message-
> From: Abhishek Pratap [mailto:abhishek@gmail.com]
> Sent: Thursday, August 30, 2012 5:47 PM
> To: Prasad, Ramit
> Subject: Re: [Tutor] using multiprocessing efficiently to process large data
> file
>
> Hi
On Aug 31, 2012, at 4:31 AM, Mark Lawrence wrote:
> On 31/08/2012 04:27, William R. Wing (Bill Wing) wrote:
>>
>> How about -
>>
> for item in iter(list):
> ….print item
>
> Overengineering? :) A list is an iterator.
>
Right you are - should have been:
for item in list:
print it
MS Windows 7 Home Premium 64-bit SP1
I've been using 3.x for a long time, but the other day I thought it
would also be good to have the latest version of 2.x available. So I
downloaded it and installed it.
I have some useful (to me) scripts that I use frequently, that I call
with Windows shortcut
As an aid to learning Python, I am currently in the process of
converting my Bash scripts into Python scripts. Through the years, as I
have accumulated a variety of sites, I have been maintaining a half
dozen or so Bash scripts that basically do the same thing: log me into a
streaming video site an
On Fri, Aug 31, 2012 at 12:49 PM, Richard D. Moores wrote:
>
> MS Windows 7 Home Premium 64-bit SP1
>
> I have some useful (to me) scripts that I use frequently, that I call
> with Windows shortcut keys. They used to open in a nice cmd.exe window
> I'd configured to my liking. Now I find that they
On 31/08/12 18:05, Ray Jones wrote:
script and have it parse. Is there another method for one Python script
to call/import/execute a Python script and integrate the name space so
that the variables in each of the calling scripts would be directly
usable by the Python module/child process/whateve
On 08/31/2012 02:19 PM, Alan Gauld wrote:
> On 31/08/12 18:05, Ray Jones wrote:
>
>> script and have it parse. Is there another method for one Python script
>> to call/import/execute a Python script and integrate the name space so
>> that the variables in each of the calling scripts would be direct
Hello,
I'm fairly new to Python and still learning.
Can someone please explain to me in what way the following function
checks if a number is a power of two? Basically, the second line of
code is what I can't really grasp:
def is_power2(num):
return num != 0 and ((num & (num - 1)) == 0)
On Fri, Aug 31, 2012 at 10:57 AM, eryksun wrote:
> On Fri, Aug 31, 2012 at 12:49 PM, Richard D. Moores
> wrote:
> https://bitbucket.org/vinay.sajip/pylauncher
> https://bitbucket.org/vinay.sajip/pylauncher/raw/tip/Doc/launcher.rst
Thank you! You solved my problem.
Dick
__
2^n in binary is 10...0 (with n 0s), and 2^n - 1 is 11...1 (with n 1s). So
if you do bitwise and (&) to 2^n and 2^n-1 you get all 0s. That's why you
check if (num & (num - 1)) == 0.
Visar Zejnullahu
On Sat, Sep 1, 2012 at 12:54 AM, Lazar wrote:
> Hello,
>
> I'm fairly new to Python and still l
http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2
You have many useful bit hacks here.
Visar Zejnullahu
On Sat, Sep 1, 2012 at 1:17 AM, Visar Zejnullahu wrote:
> 2^n in binary is 10...0 (with n 0s), and 2^n - 1 is 11...1 (with n 1s). So
> if you do bitwise and (&) to 2^n
On 8/31/2012 6:54 PM, Lazar wrote:
Hello,
I'm fairly new to Python and still learning.
Can someone please explain to me in what way the following function
checks if a number is a power of two? Basically, the second line of
code is what I can't really grasp:
def is_power2(num):
return n
Visar and Bob,
Thank you for your detailed explanations, I appreciate your help.
Kind regards,
Lazar
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 01/09/2012 00:16, Richard D. Moores wrote:
On Fri, Aug 31, 2012 at 10:57 AM, eryksun wrote:
On Fri, Aug 31, 2012 at 12:49 PM, Richard D. Moores wrote:
https://bitbucket.org/vinay.sajip/pylauncher
https://bitbucket.org/vinay.sajip/pylauncher/raw/tip/Doc/launcher.rst
Thank you! You so
On 31/08/12 23:54, Lazar wrote:
Can someone please explain to me in what way the following function
checks if a number is a power of two? Basically, the second line of
code is what I can't really grasp:
def is_power2(num):
return num != 0 and ((num & (num - 1)) == 0)
In binary any po
On 31/08/12 22:51, Ray Jones wrote:
Okay. Now I must figure out how to create the module and have my calling
script look in the right place ;)
Creating a module is just a matter of creating a standard python file
#! /bin/python# you don't even really
On 31/08/12 18:31, Mark Lawrence wrote:
On 31/08/2012 04:27, William R. Wing (Bill Wing) wrote:
How about -
for item in iter(list):
….print item
Overengineering? :) A list is an iterator.
Technically, no it isn't, it is an "iterable" or a "sequence" but
not an iterator.
py> mylist = [1,
On 08/31/2012 04:58 PM, Alan Gauld wrote:
>
> Creating a module is just a matter of creating a standard python file
>
>
> #! /bin/python# you don't even really need a shebang for modules!
> myVar = 66
> < end of myvar.py -->
>
> import myvar
> print
First of all thank you guys for all your help. The manual is really no
substitute for having things explained in laymans terms as opposed to a
technical manual.
My question is this- I've been trying for a month to generate a list of all
possible 10 digit numbers. I've googled, looked on stackov
On Fri, Aug 31, 2012 at 8:20 PM, Steven D'Aprano wrote:
>
> Sequence
> The generalisation of lists, tuples and strings. Any object that has
> a known length where individual items can be retrieved with the
> __getitem__ method called sequentially: obj[0], obj[1], obj[2], ...
To expand on th
On 08/31/2012 09:08 PM, Scurvy Scott wrote:
> First of all thank you guys for all your help. The manual is really no
> substitute for having things explained in laymans terms as opposed to a
> technical manual.
>
> My question is this- I've been trying for a month to generate a list of all
> pos
On Fri, Aug 31, 2012 at 9:08 PM, Scurvy Scott wrote:
>
> My question is this- I've been trying for a month to generate a list of
> all possible 10 digit numbers. I've googled, looked on stackoverflow,
> experimented with itertools,
In itertools, look at count() and islice(). An alternative to isl
On 08/31/2012 10:14 PM, Scurvy Scott wrote:
> Thanks for the reply. This isn't an assignment per se as I'm just learning
> python for my own sake- not in classes or school or what have you. As I said
> I'm pretty new to python picking up whatever I can and generators are
> something that I haven
On 08/31/2012 10:38 PM, Scurvy Scott wrote:
> Now I've got
>
> A = 10
> I = raw_input("file name> ")
> TheFile = open(I, 'w')
>
> TheFile.truncate
> def allten(a):
> while a < 99:
> a = + 1
> TheFile.write(a)
> allten(a)
>
> The result is:
> Open file 'file.t
Dear Scurvy,
I don't know if this has been suggested yet, but I just broke the
larger list of 10 digit nums into segments, and at the end of the loop,
kept the previous last num in the segment as the beginning of the next
range() that goes through the same amount of ints in each segmentation of
On Sat, Sep 1, 2012 at 12:29 AM, Scurvy Scott wrote:
>
> The while loop works for simply printing. Now I'm trying to save to a file
>
> I = 10
> Boogers = raw_input("file")
> Baseball = open(Boogers)
As ASCII, that's 11 bytes per number times 9 billion numbers. That's
approximately 92 GiB
You can also watch this happen by uncommenting print on line 8:
def iterToHighNum(increment,high_
num):
end_point = 0
a = [i for i in range(0,increment)]
while (end_point != high_num) == True:
for integer in a:
if integer != high_num:
print "no matc
I mean line 7.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
It might be a little buggy, but I'm in a rush, so it has a flaw in it. But
I think you get the point I'm trying to make.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Here's the better function fixed with a return statement I forgot, but
might not be as quick as the pre-built functions already shown:
def iterToHighNum(increment,high_num):
end_point = 0
a = [i for i in range(0,increment)]
while (end_point != high_num) == True:
for integer in
On 09/01/2012 01:46 AM, Dwight Hutto wrote:
> Here's the better function fixed with a return statement I forgot, but
> might not be as quick as the pre-built functions already shown:
>
> def iterToHighNum(increment,high_num):
> end_point = 0
> a = [i for i in range(0,increment)]
> while
I could comment this better.
We have a function, iterToHighNum, that takes two parameters: increment and
high_num.
increment is how long the list of numbers being added to the old increment
list of ints, to create a shorter int list that maintains the sequential
count, looking for the high number
I'm not sure what the point of any of that is; you're making a simple
> problem complex. If you're wanting to accomplish the task without using
> any of the itertools stuff, why not just:
>
>
> current = 10**9
> lim = 10**10
> while current < lim:
> print current #or write to file, or wha
44 matches
Mail list logo