On 06/08/2014 06:34, Gayathri J wrote:
Dear Peter
Below is the code I tried to check if itertools.product() was faster
than normal nested loops...
they arent! arent they supposed to be...or am i making a mistake? any idea?
*
*
*
*
*# -
Gayathri J wrote:
> Dear Peter
>
> Below is the code I tried to check if itertools.product() was faster than
> normal nested loops...
>
> they arent! arent they supposed to be...
I wouldn't have expected product() to be significantly faster, but neither
did I expect it to be slower.
> or am i
You might check numpy it is really powerful tool for working with multi
dimensional arrays:
ex.
>>> a = arange(81).reshape(3,3,3,3)
>>> a
array( 0, 1, 2],
[ 3, 4, 5],
[ 6, 7, 8]],
[[ 9, 10, 11],
[12, 13, 14],
[15, 16, 17]],
[[18, 1
I have a gmail account 'x...@gmail.com' which subscripted python
maillist. To take part in python discussion is the only target for my
x...@gmail.com. There are so many emails in my x...@gmail.com,it is a good
idea for me to auto delete all emails whose body contain no . I write
some codes to d
elearn writes:
> status, data= con.search(None, "ALL")
> print(len(data[0].split()))
> 48
> typ, data= con.search(None, 'Body', '"x...@gmail.com"')
> >>> data
> [b'1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
> 29
> 32 33 34 35 36 37 44']
>
> len(data[0].sp
On Wed, 06 Aug 2014 12:07:58 +1000, Chris Angelico wrote:
> On Wed, Aug 6, 2014 at 10:49 AM, Steven D'Aprano
> wrote:
>> A
>> plethora of argument-less methods is a code smell -- that doesn't mean
>> it's *necessarily* a bad idea, but the class design really needs a
>> careful review.
>
> There
On Wed, 06 Aug 2014 10:34:04 +1200, Gregory Ewing wrote:
> Grant Edwards wrote:
>> Did I miss a news story? Have the parentesis mines all exploded
>> causing the price of parenthesis to skyrocket?
>
> The Unicode Consortium has been secretly buying them up for some time
> now. Pretty soon you wo
On Tue, 05 Aug 2014 12:39:18 -0700, Christian Calderon wrote:
> I have been using python for 4 years now, and I just started learning
> ruby.
> I like that in ruby I don't have to type parenthesis at the end of each
> function call if I don't need to provide extra arguments. I just
> realized righ
and how to write the delete command with imaplib?
On 8/6/2014 5:14 PM, Ben Finney wrote:
elearn writes:
status, data= con.search(None, "ALL")
print(len(data[0].split()))
48
typ, data= con.search(None, 'Body', '"x...@gmail.com"')
data
[b'1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1
On Wed, Aug 6, 2014 at 7:15 PM, Steven D'Aprano wrote:
> On Wed, 06 Aug 2014 12:07:58 +1000, Chris Angelico wrote:
>
>> On Wed, Aug 6, 2014 at 10:49 AM, Steven D'Aprano
>> wrote:
>>> A
>>> plethora of argument-less methods is a code smell -- that doesn't mean
>>> it's *necessarily* a bad idea, bu
elearn writes:
> and how to write the delete command with imaplib?
(Please don't top-post. Instead, compose your responses interleaved
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style> so
the conversation is easier to follow in the message.)
I'm not familiar with the API of the ‘im
Dear Peter
Yes the f[t] or f[:,:,:] might give a marginal increase, but then i need
to do further operations using the indices, in which case this wouldnt help
Dear Wojciech
np.flat() works if u dont care about the indices and only the matrix/array
values matter.
but if the matters, flatten
Gayathri J wrote:
> Dear Peter
>
> Yes the f[t] or f[:,:,:] might give a marginal increase,
The speedup compared itertools.product() is significant:
$ python -m timeit -s 'from itertools import product; from numpy.random
import rand; N = 100; a = rand(N, N, N); r = range(N)' 'for x in produc
> > Thankfully, all actually user-friendly operating systems (MacOS,
> > TOS, RiscOS, probably AmigaOS, MacOS X) spare(d) their users the
> > bottomless cesspit of "package management" and/or "installers".
> >
> > Because on such operating systems, each and every application is an
> > entirely self
> > Because on such operating systems, each and every application is an
> > entirely self-contained package that doesn't need any "packages" or
> > "installers" to use it.
> For people who have never used such a system it's probably difficult
> to see the advantages.
That's the whole point.
The
> I've worked with both. Quite honestly, I really wish that other
> operating systems had gone down this route. MS didn't possibly to make
> it harder to steal software,
>From the perspective of the computer-literate, proficient
screenworker, MS always got and gets everything completely wrong.
On Wed, Aug 6, 2014 at 10:38 PM, Wolfgang Keller wrote:
>> > Thankfully, all actually user-friendly operating systems (MacOS,
>> > TOS, RiscOS, probably AmigaOS, MacOS X) spare(d) their users the
>> > bottomless cesspit of "package management" and/or "installers".
>> >
>> > Because on such operati
On 2014-08-06 11:04, Gayathri J wrote:
> Below is the code I tried to check if itertools.product() was
> faster than normal nested loops...
>
> they arent! arent they supposed to be...or am i making a mistake?
I believe something like this was discussed a while ago and there was
a faster-but-ugli
Dear Peter
thanks . But thats what I was trying to say
just taking them to zero by f[:,:,:] = 0.0 or using np.zeros is surely
going to give me a time gain...
but my example of using the itertools.product() and doing f[x] =0.0 is just
to compare the looping timing with the traditional nested loops
On Wednesday, May 28, 2014 6:38:22 PM UTC-4, Ben Finney wrote:
> Larry Martell writes:
>
>
>
> > No company that I work for is using python 3 - they just have too much
>
> > of an investment in a python 2 code base to switch.
>
>
>
> There are many large companies still using FORTRAN and CO
I have a gmail account 'x...@gmail.com' which subscripted python
maillist. I want to delete any emails which is sent to
python-list@python.org .
|import imaplib
user="xxx"
password="yy"
con=imaplib.IMAP4_SSL('imap.gmail.com')
con.login(user,password)
con.select('[Gmail]/&YkBnCZCuTvY-')
typ
My apologies. I must be dense. Why do you want to do this from Python?
Can't you accomplish the same thing more easily with a Gmail filter
which deletes all messages sent to python-list@python.org? Also, I
assume that if you use "x...@gmail.com" only so you can send mail to
the list, why not just d
On Wed, 6 Aug 2014 05:13:07 + (UTC)
Grant Edwards wrote:
> On 2014-08-05, Gregory Ewing wrote:
> > Grant Edwards wrote:
> >> Did I miss a news story? Have the parentesis mines all exploded
> >> causing the price of parenthesis to skyrocket?
> >
> > The Unicode Consortium has been secretly b
2014-08-03 16:01 GMT+02:00 Valery Khamenya :
> Hi all
>
> [snip]
>
> Consider a task like crawling the web starting from some web-sites. Each
> site leads to generation of new downloading tasks in exponential(!)
> progression. However we don't want neither to flood the event loop nor to
> overload
On Fri, Aug 1, 2014 at 10:53 PM, Akira Li <4kir4...@gmail.com> wrote:
> Wolfgang Maier writes:
>
>> On 08/01/2014 01:30 AM, Roy Smith wrote:
>>> In article ,
>>> Albert-Jan Roskam wrote:
>>>
> In article ,
> Wolfgang Maier wrote:
>
>> Hi,
>> I'm trying to convert ISO8601-co
On 8/6/2014 9:47 AM, beliav...@aol.com.dmarc.invalid wrote:
Fortran compiler vendors such as Intel, IBM, Oracle/SUN and open
*Vendors* sell compilers for money, which they can then use to *pay*
people to do unfun stuff that volunteers don't want and should not have
to do.
Actually, I am be
On 8/6/2014 6:09 AM, alister wrote:
On Wed, 06 Aug 2014 10:34:04 +1200, Gregory Ewing wrote:
Grant Edwards wrote:
Did I miss a news story? Have the parentesis mines all exploded
causing the price of parenthesis to skyrocket?
The Unicode Consortium has been secretly buying them up for some t
On Wed, Aug 6, 2014 at 1:31 PM, Joel Goldstick wrote:
> Among other features it lists this: Gaps in functionality: ISO-8601
> parsing, timespans, humanization
What is "humanization"?
Skip
--
https://mail.python.org/mailman/listinfo/python-list
Suppose I have a directory C:/Test that is either empty or contains more
than 200 files, all with the same extension (e.g. *.txt). How can I
determine if the directory is empty WITHOUT the generation of a list of
the file names in it (e.g. using os.listdir('C:/Test')) when it is not
empty?
Virgil Stokes writes:
> Suppose I have a directory C:/Test that is either empty or contains
> more than 200 files, all with the same extension (e.g. *.txt). How
> can I determine if the directory is empty WITHOUT the generation of a
> list of the file names in it (e.g. using os.listdir('C:/Te
On 2014-08-07 08:26, Ben Finney wrote:
> Virgil Stokes writes:
> > Suppose I have a directory C:/Test that is either empty or
> > contains more than 200 files, all with the same extension
> > (e.g. *.txt). How can I determine if the directory is empty
> > WITHOUT the generation of a list of th
On 05Aug2014 07:03, varun...@gmail.com wrote:
Thank you Cameron. Your post was very helpful. If you don't mind I'd like to
ask you the purpose of the final list in the very beginning of the code. It is
being updated and then checked for the presence of a literal. If a literal is
found it retu
On 8/6/2014 6:44 PM, Tim Chase wrote:
On 2014-08-07 08:26, Ben Finney wrote:
Virgil Stokes writes:
Suppose I have a directory C:/Test that is either empty or
contains more than 200 files, all with the same extension
(e.g. *.txt). How can I determine if the directory is empty
WITHOUT the ge
Tim Chase writes:
> The difference in timings when serving a web-request are noticeable
> (in my use-case, I had to change my algorithm and storage structure to
> simplify/avoid heavily-populated directories)
So, if the requirement is “test whether the directory is empty faster
than N microsecon
Terry Reedy wrote:
> On 8/6/2014 9:47 AM, beliav...@aol.com.dmarc.invalid wrote:
>
>> Fortran compiler vendors such as Intel, IBM, Oracle/SUN and open
>
> *Vendors* sell compilers for money, which they can then use to *pay*
> people to do unfun stuff that volunteers don't want and should not hav
number = 7
guess = -1
count = 0
print("Guess the number!")
while guess != number:
guess = int(input("Is it... "))
count = count + 1
if guess == number:
print("Hooray! You guessed it right!")
elif guess < number:
print("It's bigger...")
elif guess > number:
On Thu, Aug 7, 2014 at 12:58 PM, Seymore4Head
wrote:
> Why not?
> I think I know why it isn't working, but I don't know enough yet on
> how it should work.
> The If statement isn't getting read.
One thing you need to learn about Python... or, for that matter,
pretty much any language. "It isn't w
In Seymore4Head
writes:
> number = 7
> guess = -1
> count = 0
>
> print("Guess the number!")
> while guess != number:
> guess = int(input("Is it... "))
> count = count + 1
> if guess == number:
> print("Hooray! You guessed it right!")
> elif guess < number:
> p
Ben Finney wrote:
> Virgil Stokes writes:
>
>> Suppose I have a directory C:/Test that is either empty or contains
>> more than 200 files, all with the same extension (e.g. *.txt). How
>> can I determine if the directory is empty WITHOUT the generation of a
>> list of the file names in it (e
On Wed, 06 Aug 2014 22:58:51 -0400, Seymore4Head
wrote:
>number = 7
>guess = -1
>count = 0
>
>print("Guess the number!")
>while guess != number:
>guess = int(input("Is it... "))
>count = count + 1
>if guess == number:
>print("Hooray! You guessed it right!")
>elif guess <
Wolfgang Keller wrote:
> Linux was made by geeks who didn't have a clue of ergonomics for
> screenworkers and didn't care to get one.
I can only repeat what you said earlier:
"You should get a clue in stead [sic] of just fantasizing up assumptions
based on ignorance."
I daresay that Linus Torva
Seymore4Head wrote:
[snip code that looks fine to me]
> Why not?
I don't know. What does "doesn't work" mean?
"It didn't do what I expected." (What did you expect? What did it do?)
"It printed an error message." (Care to tell it what it was?)
"It crashed the computer." (Some more details migh
beliav...@aol.com wrote:
> Fortran compiler vendors such as Intel, IBM, Oracle/SUN and open source
> projects such as gfortran are updating their compilers to the Fortran 2003
> and 2008 standards while also keeping the ability to compile all the old
> Fortran code. FORTRAN 77 programmers and prog
Seymore4Head wrote:
> On Wed, 06 Aug 2014 22:58:51 -0400, Seymore4Head
> wrote:
>
>>number = 7
>>guess = -1
>>count = 0
>>
>>print("Guess the number!")
>>while guess != number:
>>guess = int(input("Is it... "))
>>count = count + 1
>>if guess == number:
>>print("Hooray! You g
On Thu, 07 Aug 2014 13:43:40 +1000, Steven D'Aprano
wrote:
>Seymore4Head wrote:
>
>> On Wed, 06 Aug 2014 22:58:51 -0400, Seymore4Head
>> wrote:
>>
>>>number = 7
>>>guess = -1
>>>count = 0
>>>
>>>print("Guess the number!")
>>>while guess != number:
>>>guess = int(input("Is it... "))
>>>
On 7/08/2014 1:25 PM, Seymore4Head wrote:
This part was added as an exercise.
A counter is added to give 3 tries to guess the number.
It is supposed to stop after count gets to 3. It doesn't. It just
keeps looping back and asking for another guess.
You've misread the exercise:
Modify the hig
On 08/06/2014 08:48 PM, Seymore4Head wrote:
On Thu, 07 Aug 2014 13:43:40 +1000, Steven D'Aprano
wrote:
Seymore4Head wrote:
On Wed, 06 Aug 2014 22:58:51 -0400, Seymore4Head
wrote:
[snip]
Ah, now things make sense! Your subject line is misleading! It's not that
the wikibooks example doesn
The if statement in question isn't inside the while loop.
White space and indentation is meaningful in python, so putting the if count >
3 block at same indentation as the while statement effectively places it
outside the loop.
Regards,
Drew
Original message
From: Seymore4Hea
Larry Hudson writes:
> I just took a look at that web page, and I see what your problem
> actually is...
> You are misunderstanding the problem. The problem does NOT say to end
> the loop at three tries, just to keep track of the number of tries.
> It's not actually specific, but the implication
Virgil Stokes wrote:
How can I
determine if the directory is empty WITHOUT the generation of a list of
the file names
Which platform?
On Windows, I have no idea.
On Unix you can't really do this properly without access
to opendir() and readdir(), which Python doesn't currently
wrap.
Will th
Hi,
Code:
import os, time
def child(pipeout):
zzz = 0
while True:
time.sleep(zzz)
msg = ('Spam %03d' % zzz).encode()
os.write(pipeout, msg)
zzz = (zzz+1) % 5
def parent():
pipein, pipeout = os.pipe()
if os.fork() == 0:
child(pipeout)
else
51 matches
Mail list logo