Chris Angelico :
> On Wed, Nov 30, 2016 at 7:07 AM, Marko Rauhamaa wrote:
> Any of these that depend on pumping the entire iterable can simply
> synchronify [1] the iterable:
One of the more useful ones might be:
o = await anext(ait)
> list(x async for x in aiterable)
>
> Interestingly, I
"Frank Millman" wrote in message news:o1k355$da5$1...@blaine.gmane.org...
Hi all
Python 3.6 has introduced Asynchronous Generators, which work very well.
[...]
However, it does not allow you to enumerate over the generator output -
[...]
Is there any technical reason for this, or is it
On Tue, 29 Nov 2016 18:29:51 -0800, Paul Rubin wrote:
> Wildman writes:
>> names = array.array("B", '\0' * bytes)
>> TypeError: cannot use a str to initialize an array with typecode 'B'
>
> In Python 2, str is a byte string and you can do that. In Python 3,
> str is a unicode string, and if
On Wednesday 30 November 2016 10:59, woo...@gmail.com wrote:
> If you want to do something only if the file exists (or does not), use
> os.path.isfile(filename)
No, don't do that. Just because the file exists, doesn't mean that you have
permission to read or write to it.
Worse, the code is vuln
On Wed, Nov 30, 2016 at 7:07 AM, Marko Rauhamaa wrote:
> Ok, so how about:
>
>aall(aiterable)
>aany(aiterable)
>class abytearray(aiterable[, encoding[, errors]])
>class adict(aiterable, **kwarg)
>class afilter(coro, aiterable)
>class afrozenset(aiterable)
>aiter(object[
Wildman writes:
> names = array.array("B", '\0' * bytes)
> TypeError: cannot use a str to initialize an array with typecode 'B'
In Python 2, str is a byte string and you can do that. In Python 3,
str is a unicode string, and if you want a byte string you have to
specify that explicitly, like
For the purpose of learning I am writing a script that will
return different information about the Linux machine where
it is running. Sort of like the inxi utility.
Below is some code that I found that returns a list of the
network interface devices on the system. It runs as is
perfectly on Pyth
On Tue, 29 Nov 2016 at 23:59 wrote:
> If you want to do something only if the file exists (or does not), use
> os.path.isfile(filename)
>
This opens you up to a potential race condition (and has potential security
implications, depending on the application), as you're using LBYL[0].
If you want
On 29/11/2016 23:58, paul.garcia2...@gmail.com wrote:
Write a program which prints the sum of numbers from 1 to 101 ( 1 and 101 are
included) that are divisible by 5 (Use while loop)
This is the code:
x=0
count=0
while x<=100:
if x%5==0:
count=count+x
x=x+1
print(count)
This
On 2016-11-29 23:58, paul.garcia2...@gmail.com wrote:
Write a program which prints the sum of numbers from 1 to 101 ( 1 and 101 are
included) that are divisible by 5 (Use while loop)
This is the code:
x=0
count=0
while x<=100:
if x%5==0:
count=count+x
x=x+1
print(count)
Quest
If you want to do something only if the file exists (or does not), use
os.path.isfile(filename)
--
https://mail.python.org/mailman/listinfo/python-list
Add some print statements to see what is happening, especially after the for
elem in mylist1: statement
--
https://mail.python.org/mailman/listinfo/python-list
Write a program which prints the sum of numbers from 1 to 101 ( 1 and 101 are
included) that are divisible by 5 (Use while loop)
This is the code:
x=0
count=0
while x<=100:
if x%5==0:
count=count+x
x=x+1
print(count)
Question: How does python know what count means ? I
On Wed, 30 Nov 2016 05:41 am, Ian Kelly wrote:
> You mean how do you create something that can be awaited that doesn't
> await something else in turn? With a Future.
>
> import asyncio
>
> class Awaitable(asyncio.Future):
> def wake_up_later(self):
> asyncio.get_event_loop().call_later(3,
On Wed, 30 Nov 2016 07:07 am, Marko Rauhamaa wrote:
> Terry Reedy :
>
>> On 11/29/2016 9:25 AM, Frank Millman wrote:
>>
>>> Is there any technical reason for this, or is it just that no-one has
>>> got around to writing an asynchronous version yet?
>>
>> Google's first hit for 'aenumerate' is
>>
On Wed, 30 Nov 2016 01:17 am, Heli wrote:
> The following line which reads the entire 7.4 GB file increments the
> memory usage by 3206.898 MiB (3.36 GB). First question is Why it does not
> increment the memory usage by 7.4 GB?
>
> f=np.loadtxt(os.path.join(dir,myfile),delimiter=None,skiprows=0)
Terry Reedy :
> On 11/29/2016 9:25 AM, Frank Millman wrote:
>
>> Is there any technical reason for this, or is it just that no-one has
>> got around to writing an asynchronous version yet?
>
> Google's first hit for 'aenumerate' is
> https://pythonwise.blogspot.com/2015/11/aenumerate-enumerate-for
On 11/29/2016 9:25 AM, Frank Millman wrote:
Is there any technical reason for this, or is it just that no-one has
got around to writing an asynchronous version yet?
Google's first hit for 'aenumerate' is
https://pythonwise.blogspot.com/2015/11/aenumerate-enumerate-for-async-for.html
Note that
I am trying to split a specific column of csv into multiple column and then
appending the split values at the end of each row.
`enter code here`
import csv
fOpen1=open('Meta_D1.txt')
reader=csv.reader(fOpen1)
mylist=[elem[1].split(',') for elem in
On Mon, Nov 28, 2016 at 10:42 PM, Chris Angelico wrote:
> On Tue, Nov 29, 2016 at 4:13 PM, Paul Rubin wrote:
>>
>> I haven't gotten my head around Python asyncio and have been wanting
>> to read this:
>>
>>http://lucumr.pocoo.org/2016/10/30/i-dont-understand-asyncio/
>
> It's talking a lot ab
On 29/11/2016 14:17, Heli wrote:
Hi all,
Let me update my question, I have an ascii file(7G) which has around 100M
lines. I read this file using :
f=np.loadtxt(os.path.join(dir,myfile),delimiter=None,skiprows=0)
x=f[:,1]
y=f[:,2]
z=f[:,3]
id=f[:,0]
I will need the x,y,z and id arrays later
On Tuesday, November 29, 2016 at 3:18:29 PM UTC+1, Heli wrote:
> Hi all,
>
> Let me update my question, I have an ascii file(7G) which has around 100M
> lines. I read this file using :
>
> f=np.loadtxt(os.path.join(dir,myfile),delimiter=None,skiprows=0)
>
> x=f[:,1]
> y=f[:,2]
> z=f[:,3]
On Tue, Nov 29, 2016 at 7:25 AM, Frank Millman wrote:
> However, it does not allow you to enumerate over the generator output -
>
async def main():
>
> ... c = counter(5)
> ... async for j, k in enumerate(c):
> ... print(j, k)
> ... print('done')
> ...
loop.run_until_compl
Heli writes:
> Hi all,
>
> Let me update my question, I have an ascii file(7G) which has around
> 100M lines. I read this file using :
>
> f=np.loadtxt(os.path.join(dir,myfile),delimiter=None,skiprows=0)
>
> x=f[:,1]
> y=f[:,2]
> z=f[:,3]
> id=f[:,0]
>
> I will need the x,y,z and id arrays
Hi all
Python 3.6 has introduced Asynchronous Generators, which work very well.
Python 3.6.0b4 (default, Nov 22 2016, 05:30:12) [MSC v.1900 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
import asyncio
loop = asyncio.get_event_loop()
async def
Hi all,
Let me update my question, I have an ascii file(7G) which has around 100M
lines. I read this file using :
f=np.loadtxt(os.path.join(dir,myfile),delimiter=None,skiprows=0)
x=f[:,1]
y=f[:,2]
z=f[:,3]
id=f[:,0]
I will need the x,y,z and id arrays later for interpolations. The prob
Because the deadline is imminent and because we have only received some
proposals, we will extend the current deadline. The new submission deadline is
2016-12-18.
Call For Proposals
==
This is the official call for sessions for the Python devroom at FOSDEM 2017.
FOSDEM is the Fr
Peter Otten <__pete...@web.de>:
> Marko Rauhamaa wrote:
>
>> However, I think the real answer is that you shouldn't mix the "with"
>> construct with exception handling. Instead you should write:
>>
>>try:
>>f = open("xyz")
>>except FileNotFoundError:
>>...[B]...
>>try:
Marko Rauhamaa wrote:
> However, I think the real answer is that you shouldn't mix the "with"
> construct with exception handling. Instead you should write:
>
>try:
>f = open("xyz")
>except FileNotFoundError:
>...[B]...
>try:
>...[A]...
>finally:
>f
Steven D'Aprano :
> There is no need to catch the exception if you're not going to do
> anything with it.
Correct. However, the question of the subject line is still a good one.
See:
try:
with open("xyz") as f:
...[A]...
except FileNotFoundError:
...[B]...
The
30 matches
Mail list logo