"Veek. M" writes:
> ...
> what i wanted to know was, x = Client('192.168.0.1') will create an
> object 'x' with the IP inside it. When I do:
> pickle.dump(x)
> pickle doesn't know where in the object the IP is, so he'll call
> __getstate__ and expect the return value to be the IP, right?
It doe
On Thu, Mar 10, 2016 at 6:46 PM, Alexander Shmugliakov
wrote:
> Hello, has anybody successfully installed ibm_db package in the 32-bit Python
> 3.5.0 environment? This is the error messages I'm receiving:
> I know that the message about vcvarsall.bat is related to the Visual Studio
> configurati
Hi,
In my FPGA related work, I had to generate and verify different non-standard
CRC sums in a Python based testbench.
I was able to find a few CRC implementations for Python (e.g. crcmod or PyCRC),
but none of them was able to work with arbitrary CRC polynomial and data of
arbitrary length. Th
Pietro Paolini writes:
> ...
> I am not really familiar with the Py subsystem, even though I have got some
> guidance from some colleague, I am getting stuck when installing a list of
> packages contained in a file, running such command :
>
>
> pip install -r /home/pietro/projects/cloud-provisioni
On Thursday 10 March 2016 07:09, Drimades wrote:
> I'm doing some tests with operations on numpy matrices in Python. As an
> example, it takes about 3000 seconds to compute eigenvalues and
> eigenvectors using scipy.linalg.eig(a) for a matrix 6000x6000. Is it an
> acceptable time?
I don't know w
On 10/03/2016 08:09, Chris Angelico wrote:
On Thu, Mar 10, 2016 at 6:46 PM, Alexander Shmugliakov
wrote:
Hmm. I don't understand the warning there, but the final error is
pretty straight-forward: you cannot build a package from source
without having Visual Studio installed. Sadly, my usual go-t
Hi all,
I am a new learner about python (moving from R to python) and trying read and
count the number of observation by year for each city.
The data set look like
city year x
XC1 2001 10
XC1 2001 20
XC1 2002 20
XC1 2002 10
XC1 2002 10
Yv2 2001 10
Yv2 2002 20
Yv2 2002
>From the following input
9
BANANA FRIES 12
POTATO CHIPS 30
APPLE JUICE 10
CANDY 5
APPLE JUICE 10
CANDY 5
CANDY 5
CANDY 5
POTATO CHIPS 30
I'm expecting the following output
BANANA FRIES 12
POTATO CHIPS 60
APPLE JUICE 20
CANDY 20
However my code seems be returning incorrect value
#!/usr/bin/env
Val Krem writes:
> Hi all,
>
> I am a new learner about python (moving from R to python) and trying
> read and count the number of observation by year for each city.
>
>
> The data set look like
> city year x
>
> XC1 2001 10
> XC1 2001 20
> XC1 2002 20
> XC1 2002 10
> XC1 2002 10
>
Hello and welcome.
Please see my comments below.
On 09/03/2016 21:30, Val Krem via Python-list wrote:
Hi all,
I am a new learner about python (moving from R to python) and trying read and
count the number of observation by year for each city.
The data set look like
city year x
XC1 2001
Jussi Piitulainen wrote:
> Val Krem writes:
>
>> Hi all,
>>
>> I am a new learner about python (moving from R to python) and trying
>> read and count the number of observation by year for each city.
>>
>>
>> The data set look like
>> city year x
>>
>> XC1 2001 10
>> XC1 2001 20
>> XC1 2002
Try to do a .split(' ') and then add field 0 and 1 to an list.
For open the file you can do it easier:
with open(file) as f:
for line in f:
print('line')
-Original Message-
From: Python-list
[mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of
Val Krem via Pyt
On Thursday, March 10, 2016 at 10:09:26 AM UTC+2, Chris Angelico wrote:
> On Thu, Mar 10, 2016 at 6:46 PM, Alexander Shmugliakov
> wrote:
> > Hello, has anybody successfully installed ibm_db package in the 32-bit
> > Python 3.5.0 environment? This is the error messages I'm receiving:
> > I know t
Hi.
This looks a little like a homework problem, so I'll be cryptic ... :)
On 10/03/16 09:02, Rodrick Brown wrote:
From the following input
9
BANANA FRIES 12
POTATO CHIPS 30
APPLE JUICE 10
CANDY 5
APPLE JUICE 10
CANDY 5
CANDY 5
CANDY 5
POTATO CHIPS 30
if m:
if m.group(1) not
Rodrick Brown wrote:
> From the following input
>
> 9
> BANANA FRIES 12
> POTATO CHIPS 30
> APPLE JUICE 10
> CANDY 5
> APPLE JUICE 10
> CANDY 5
> CANDY 5
> CANDY 5
> POTATO CHIPS 30
>
> I'm expecting the following output
> BANANA FRIES 12
> POTATO CHIPS 60
> APPLE JUICE 20
> CANDY 20
>
> Howeve
Rodrick Brown wrote:
> […]
> if m:
> if m.group(1) not in od.keys():
> od[m.group(1)] = int(m.group(2))
> else:
> od[m.group(1)] += int(od.get(m.group(1),0))
> […]
This program logic appears to be wrong as you are not adding the value that
you just read to the dic
Ben Finney :
> As for how solved it is, that depends on what you're hoping for as a
> solution.
>
> [...]
>
> Hopefully your operating system has a good input method system, with
> many input methods available to choose from. May you find a decent
> default there.
I don't have an answer. I have r
Thomas 'PointedEars' Lahn wrote:
> key = m.group(1)
> value = int(m.group(1))
value = int(m.group(2))
> if key not in od:
> od[key] = value
> else:
> od[key] += value
--
PointedEars
Twitter: @PointedEars2
Please do not cc me. / Bit
Dear all,
I need to loop over a numpy array and then do the following search. The
following is taking almost 60(s) for an array (npArray1 and npArray2 in the
example below) with around 300K values.
for id in np.nditer(npArray1):
newId=(np.where(npArray2==id))[0][0]
On 2016-03-10, Dennis Lee Bieber wrote:
> On Wed, 9 Mar 2016 12:28:30 - (UTC), Jon Ribbens
> declaimed the following:
>>On 2016-03-09, Ian Kelly wrote:
>>> It looks like the shell environment that comes with Git for Windows is
>>> actually Windows Powershell [1], so presumably the activate.ps
On 10/03/2016 07:30, Mark Lawrence wrote:
On 10/03/2016 00:58, BartC wrote:
You think a bloody great compiler is a microbenchmark?!
I have no interest in the speed of the compiler, I am interested in the
run time speed of the applications that it produces which is what has
been discussed thu
On Thursday, March 10, 2016 at 4:21:15 PM UTC+5:30, Marko Rauhamaa wrote:
> Ben Finney :
>
> > As for how solved it is, that depends on what you're hoping for as a
> > solution.
> >
> > [...]
> >
> > Hopefully your operating system has a good input method system, with
> > many input methods availa
On 10/03/2016 11:50, BartC wrote:
On 10/03/2016 07:30, Mark Lawrence wrote:
On 10/03/2016 00:58, BartC wrote:
You think a bloody great compiler is a microbenchmark?!
I have no interest in the speed of the compiler, I am interested in the
run time speed of the applications that it produces w
On 10/03/2016 01:59, Steven D'Aprano wrote:
I think Bart is very old-school, and probably a bit behind the times when it
comes to modern compiler and interpreter technologies.
That's true. I've reached a dead-end with what I can do with
interpreted, dynamically typed byte-code, but it stills
I have a (fairly simple) Python program that scans through a
'catchall' E-Mail address for things that *might* be for me. It sends
anything that could be for me to my main E-Mail and discards the rest.
However I *occasionally* get an error from it as follows:-
Traceback (most recent call las
On 10/03/2016 12:04, c...@isbd.net wrote:
I have a (fairly simple) Python program that scans through a
'catchall' E-Mail address for things that *might* be for me. It sends
anything that could be for me to my main E-Mail and discards the rest.
However I *occasionally* get an error from it as fo
On 10/03/2016 12:15, Mark Lawrence wrote:
On 10/03/2016 11:50, BartC wrote:
Suppose you were on the development team that writes the optimising
stages of a C compiler. You need to test the performance of the code it
produces so that you can compare one optimisation with another. Would
you:
(a
On Thu, Mar 10, 2016 at 8:31 PM, Alexander Shmugliakov
wrote:
> Thank you Chris! Actually I have received your response while in the process
> (quite a lengthy one for some reason) of the VS Community Edition
> installation. Will see if it will solve my problem (or at least brings me the
> miss
Heli wrote:
> Dear all,
>
> I need to loop over a numpy array and then do the following search. The
> following is taking almost 60(s) for an array (npArray1 and npArray2 in
> the example below) with around 300K values.
>
>
> for id in np.nditer(npArray1):
>
>newId=(n
On Thu, Mar 10, 2016 at 11:47 PM, BartC wrote:
>> have no interest
>> in run time speed as they are fully aware that they'll be wasting their
>> precious development time, as they know that their code will be waiting
>> on the file, the database or the network. What have you failed to grasp
>> ab
On 10/03/2016 12:47, BartC wrote:
On 10/03/2016 12:15, Mark Lawrence wrote:
On 10/03/2016 11:50, BartC wrote:
Suppose you were on the development team that writes the optimising
stages of a C compiler. You need to test the performance of the code it
produces so that you can compare one optimi
On 10/03/2016 11:43, Heli wrote:
Dear all,
I need to loop over a numpy array and then do the following search. The
following is taking almost 60(s) for an array (npArray1 and npArray2 in the
example below) with around 300K values.
for id in np.nditer(npArray1):
newId=(np.where(npArr
On 2016-03-10, c...@isbd.net wrote:
> # Read each message into a string and then parse with the email
> module, if
> # there's an error retrieving the message then just throw it away
> #
> try:
> popmsg = pop3.retr(i+1)
> except:
>
On Fri, Mar 11, 2016 at 12:18 AM, Mark Lawrence wrote:
> I have dealt with some complete dumbos in the years that I've been online,
> but when it comes to thickos you're right up there with the RUE, and I can
> assure you that this is meant to be an insult.
>
> To your way of thinking run time spe
Hi all,
I've been studying Object Oriented Theory using Java. Theoretically, all
attributes should be private, meaning no one except the methods itself
can access the attribute;
public class Foo {
private int bar;
...
Normally in Java, we would write getters and setters to set/get the
at
On 10/03/2016 13:08, Chris Angelico wrote:
When people want better performance out of a number-crunching Python
program, they have a few options. One is to rewrite their code in C or
Fortran or something. Another is to make small tweaks so the bulk of
the work is handled by numpy or Cython. A th
On 10/03/2016 13:41, Ben Mezger wrote:
Hi all,
I've been studying Object Oriented Theory using Java. Theoretically, all
attributes should be private, meaning no one except the methods itself
can access the attribute;
I suggest that you read
http://dirtsimple.org/2004/12/python-is-not-java.htm
Jon Ribbens wrote:
> On 2016-03-10, c...@isbd.net wrote:
> > # Read each message into a string and then parse with the email
> > module, if
> > # there's an error retrieving the message then just throw it away
> > #
> > try:
> > popmsg = pop3.retr(i
Mark Lawrence wrote:
> On 10/03/2016 12:04, c...@isbd.net wrote:
> > I have a (fairly simple) Python program that scans through a
> > 'catchall' E-Mail address for things that *might* be for me. It sends
> > anything that could be for me to my main E-Mail and discards the rest.
> >
> > However I
Having received almost 300 great proposals for talks, trainings,
helpdesks and posters, we now call out to all attendees to vote for
what you want to see on the conference schedule.
Please note that you have to have a ticket for EuroPython 2016, or
have submitted a talk proposal yourself, in order
On 10/03/2016 13:08, Chris Angelico wrote:
On Thu, Mar 10, 2016 at 11:47 PM, BartC wrote:
You just don't get it.
Both of you "just don't get" something that the other sees as
critically important. Before this thread gets to fisticuffs, may I
please summarize the points that probably nobody
On 10/03/2016 02:29, Ben Finney wrote:
BartC writes:
So long as /someone else/ uses the hard language to created the needed
libraries, the speed of pure Python is irrelevant. New version of
Python is now half the speed? Another shrug!
Citation needed. I don't know of any released version of
On Thu, Mar 10, 2016 at 5:51 AM, Marko Rauhamaa wrote:
> I don't have an answer. I have requirements, though:
>
> * I should be able to get the character by knowing its glyph (shape).
>
> * It should be very low-level and work system-wide, preferably over the
>network (I'm typing this over t
> I've been studying Object Oriented Theory using Java. Theoretically, all
> attributes should be private, meaning no one except the methods itself can
> access the attribute;
>
> public class Foo {
> private int bar;
> ...
Why? I mean sure, lots of them should be, but if I am doing some
Jerry Hill :
> On Thu, Mar 10, 2016 at 5:51 AM, Marko Rauhamaa wrote:
>> I don't have an answer. I have requirements, though:
>>
>> * I should be able to get the character by knowing its glyph (shape).
>>
>> * It should be very low-level and work system-wide, preferably over the
>>network (
On Thu, Mar 10, 2016 at 6:41 AM, Ben Mezger wrote:
> Hi all,
>
> I've been studying Object Oriented Theory using Java. Theoretically, all
> attributes should be private, meaning no one except the methods itself
> can access the attribute;
>
> public class Foo {
> private int bar;
> ...
En
Thomas 'PointedEars' Lahn wrote:
[
> key = m.group(1)
> value = int(m.group(2))
>
> if key not in od:
> od[key] = value
> else:
> od[key] += value
>
> But there is probably an even more pythonic way to do this.
]
For example, based on the orig
Thomas 'PointedEars' Lahn wrote:
> od = OrderedDict()
This is pointless, then.
> […]
> od = OrderedDict(map(lambda item: (item[0], 0), items))
> for item in items: od[item[0]] += item[1]
--
PointedEars
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail
I don't register domain names in countries - any domain name which ends
with 2 letters. If you want you can register my name in .cn or any other
country, I don't care.
*Uri Even-Chen*
[image: photo] Phone: +972-54-3995700
Email: u...@speedy.net
Website: http://www.speedysoftware.com/uri/en/
On Thursday, March 10, 2016 at 2:02:57 PM UTC+1, Peter Otten wrote:
> Heli wrote:
>
> > Dear all,
> >
> > I need to loop over a numpy array and then do the following search. The
> > following is taking almost 60(s) for an array (npArray1 and npArray2 in
> > the example below) with around 300K val
On Thursday, March 10, 2016 at 5:49:07 PM UTC+1, Heli wrote:
> On Thursday, March 10, 2016 at 2:02:57 PM UTC+1, Peter Otten wrote:
> > Heli wrote:
> >
> > > Dear all,
> > >
> > > I need to loop over a numpy array and then do the following search. The
> > > following is taking almost 60(s) for an
Hello everyone,
I recently came across a package called matrix2latex which simplifies the
creation of very large tables. So, I saved my data in .mat format using the
'-v7.3' extension so that they can be read by python.
Now, when I try to read these files, I'm having some problems in reproducin
Thank you very much for the help.
First I want count by city and year.
City year count
Xc1.2001. 1
Xc1.2002. 3
Yv1. 2001. 1
Yv2.2002. 4
This worked fine !
Now I want to count by city only
City. Count
Xc1. 4
Yv2. 5
Then combine these two objects with the original data and
On Wednesday, March 9, 2016 at 9:49:17 AM UTC+5:30, subhaba...@gmail.com wrote:
> Dear Group,
>
> I am trying to write a code for pulling data from MySQL at the backend and
> annotating words and trying to put the results as separated sentences with
> each line. The code is generally running fin
On 3/10/2016 4:02 AM, Rodrick Brown wrote:
From the following input
9
BANANA FRIES 12
POTATO CHIPS 30
APPLE JUICE 10
CANDY 5
APPLE JUICE 10
CANDY 5
CANDY 5
CANDY 5
POTATO CHIPS 30
I'm expecting the following output
BANANA FRIES 12
POTATO CHIPS 60
APPLE JUICE 20
CANDY 20
However my code seems
Is there a way to ensure resource cleanup with a construct such as:
x = load (open ('my file', 'rb))
Is there a way to ensure this file gets closed?
--
https://mail.python.org/mailman/listinfo/python-list
On 10/03/2016 18:12, subhabangal...@gmail.com wrote:
On Wednesday, March 9, 2016 at 9:49:17 AM UTC+5:30, subhaba...@gmail.com wrote:
Thank you Steve for writing the whole code. It is working full
and fine. But speed is still an issue. We need to speed up.
Which bit is too slow? (Perhaps the
On Thursday, March 10, 2016 at 10:33:47 AM UTC-8, Neal Becker wrote:
> Is there a way to ensure resource cleanup with a construct such as:
>
> x = load (open ('my file', 'rb))
>
> Is there a way to ensure this file gets closed?
with open('my file', 'rb') as f:
x = load(f)
--
https://mail.p
On 10 March 2016 at 18:12, wrote:
> Matt, thank you for if...else suggestion, the data of NewTotalTag.txt
> is like a simple list of words with unconventional tags, like,
>
> w1 tag1
> w2 tag2
> w3 tag3
> ...
> ...
> w3 tag3
>
> like that.
I suspected so. The way your code currently works, if y
sohcahto...@gmail.com wrote:
> On Thursday, March 10, 2016 at 10:33:47 AM UTC-8, Neal Becker wrote:
>> Is there a way to ensure resource cleanup with a construct such as:
>>
>> x = load (open ('my file', 'rb))
>>
>> Is there a way to ensure this file gets closed?
>
> with open('my file', 'rb')
On Thu, Mar 10, 2016 at 11:59 AM, Neal Becker wrote:
> sohcahto...@gmail.com wrote:
>
>> On Thursday, March 10, 2016 at 10:33:47 AM UTC-8, Neal Becker wrote:
>>> Is there a way to ensure resource cleanup with a construct such as:
>>>
>>> x = load (open ('my file', 'rb))
>>>
>>> Is there a way to e
SQL doesn't allow decimal numbers for LIMIT.
Use decimal numbers it still work but is the proper way.
Then clean up a bit your code and remove the commented lines #
-Original Message-
From: Python-list
[mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of
subhab
On 10/03/2016 14:22, BartC wrote:
But during development, it doesn't hurt if the dynamic version isn't
quite so slow!
In [1]: import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than c
On 10/03/2016 14:57, Dan Strohl via Python-list wrote:
I've been studying Object Oriented Theory using Java. Theoretically, all
attributes should be private, meaning no one except the methods itself can
access the attribute;
public class Foo {
private int bar;
...
For the benefit o
On 10/03/2016 18:33, Neal Becker wrote:
Is there a way to ensure resource cleanup with a construct such as:
x = load (open ('my file', 'rb))
Is there a way to ensure this file gets closed?
I don't see how there can be. Surely you must split it into two lines
to use the context manager via
On 09/03/2016 04:18, subhabangal...@gmail.com wrote:
Dear Group,
I am trying to write a code for pulling data from MySQL at the backend and
annotating words and trying to put the results as separated sentences with each
line. The code is generally running fine but I am feeling it may be better
On Fri, Mar 11, 2016 at 1:22 AM, BartC wrote:
>>
>> 1) Unicode support, intrinsic to the language, is crucial, even if
>> BartC refuses to recognize this. Anything released beyond the confines
>> of his personal workspace will need full Unicode support, otherwise it
>> is a problem to the rest of
On Friday, March 11, 2016 at 12:22:31 AM UTC+5:30, Matt Wheeler wrote:
> On 10 March 2016 at 18:12, wrote:
> > Matt, thank you for if...else suggestion, the data of NewTotalTag.txt
> > is like a simple list of words with unconventional tags, like,
> >
> > w1 tag1
> > w2 tag2
> > w3 tag3
> > ...
>
On Fri, Mar 11, 2016 at 5:33 AM, Neal Becker wrote:
> Is there a way to ensure resource cleanup with a construct such as:
>
> x = load (open ('my file', 'rb))
>
> Is there a way to ensure this file gets closed?
Yep!
def read_file(fn, *a, **kw):
with open(fn, *a, **kw) as f:
return f.
On Fri, Mar 11, 2016 at 2:13 AM, Marko Rauhamaa wrote:
> Jerry Hill :
>
>> On Thu, Mar 10, 2016 at 5:51 AM, Marko Rauhamaa wrote:
>>> I don't have an answer. I have requirements, though:
>>>
>>> * I should be able to get the character by knowing its glyph (shape).
>>>
>>> * It should be very lo
when I put a Python script in pipe with other commands, it will refuse
to let go silently. Any way I can avoid this?
$ python somescript.py | head -5
line 1
line 3
line 3
line 4
line 5
Traceback (most recent call last):
File "./somescript.py", line 50, in
sys.stdout.write(row[0])
Broken
On Thu, Mar 10, 2016 at 2:33 PM, Fillmore wrote:
>
> when I put a Python script in pipe with other commands, it will refuse to
> let go silently. Any way I can avoid this?
What is your script doing? I don't see this problem.
ikelly@queso:~ $ cat somescript.py
import sys
for i in range(20):
Marko Rauhamaa writes:
> Ben Finney :
>
>> As for how solved it is, that depends on what you're hoping for as a
>> solution.
>>
>> [...]
>>
>> Hopefully your operating system has a good input method system, with
>> many input methods available to choose from. May you find a decent
>> default ther
On 3/10/2016 4:46 PM, Ian Kelly wrote:
On Thu, Mar 10, 2016 at 2:33 PM, Fillmore wrote:
when I put a Python script in pipe with other commands, it will refuse to
let go silently. Any way I can avoid this?
What is your script doing? I don't see this problem.
ikelly@queso:~ $ cat somescript.p
Ian Kelly wrote:
> On Thu, Mar 10, 2016 at 2:33 PM, Fillmore
> wrote:
>>
>> when I put a Python script in pipe with other commands, it will refuse to
>> let go silently. Any way I can avoid this?
>
> What is your script doing? I don't see this problem.
>
> ikelly@queso:~ $ cat somescript.py
> i
On Thu, Mar 10, 2016 at 3:09 PM, Peter Otten <__pete...@web.de> wrote:
> I suppose you need to fill the OS-level cache:
>
> $ cat somescript.py
> import sys
>
> for i in range(int(sys.argv[1])):
> sys.stdout.write('line %d\n' % i)
> $ python somescript.py 20 | head -n5
> line 0
> line 1
> line
Ben Bacarisse :
> Marko Rauhamaa writes:
>> * I should be able to get the character by knowing its glyph
>>(shape).
>>
>> * It should be very low-level and work system-wide, preferably over
>>the network (I'm typing this over the network).
>
> I think you are a Gnus user so you probably
Rodrick Brown wrote:
if m.group(1) not in od.keys():
od[m.group(1)] = int(m.group(2))
else:
od[m.group(1)] += int(od.get(m.group(1),0))
Others have pointed out what's wrong with this, but here's
a general tip: Don't repeat complicated subexpressions
such as m.group(1
On Fri, Mar 11, 2016 at 10:24 AM, Gregory Ewing
wrote:
> Instead, pull them out and give them meaningful names.
> Doing so with the above code gives:
>
> name = m.group(1)
> value = m.group(2)
> if name not in od.keys():
> od[name] = int(value)
> else:
> od[name] += int(od.get(name
On 3/10/2016 5:16 PM, Ian Kelly wrote:
Interesting, both of these are probably worth bringing up as issues on
the bugs.python.org tracker. I'm not sure that the behavior should be
changed (if we get an error, we shouldn't just swallow it) but it does
seem like a significant hassle for writing co
On Fri, Mar 11, 2016 at 8:48 AM, Fillmore
wrote:
> On 3/10/2016 5:16 PM, Ian Kelly wrote:
>
>>
>> Interesting, both of these are probably worth bringing up as issues on
>> the bugs.python.org tracker. I'm not sure that the behavior should be
>> changed (if we get an error, we shouldn't just swall
On 10/03/2016 09:02, Rodrick Brown wrote:
From the following input
9
BANANA FRIES 12
POTATO CHIPS 30
APPLE JUICE 10
CANDY 5
APPLE JUICE 10
CANDY 5
CANDY 5
CANDY 5
POTATO CHIPS 30
I'm expecting the following output
BANANA FRIES 12
POTATO CHIPS 60
APPLE JUICE 20
CANDY 20
Here's a rather un-Py
Here's another handy Perl regex which I am not sure how to translate to
Python.
I use it to avoid processing lines that contain funny chars...
if ($string =~ /[^[:print:]]/) {next OUTER;}
:)
--
https://mail.python.org/mailman/listinfo/python-list
On Mar 10, 2016 5:15 PM, "Fillmore" wrote:
>
>
> Here's another handy Perl regex which I am not sure how to translate to
Python.
>
> I use it to avoid processing lines that contain funny chars...
>
> if ($string =~ /[^[:print:]]/) {next OUTER;}
Python's re module doesn't support POSIX character c
On 3/10/2016 7:08 PM, INADA Naoki wrote:
No. I see it usually.
Python's zen says:
Errors should never pass silently.
Unless explicitly silenced.
When failed to write to stdout, Python should raise Exception.
You can silence explicitly when it's safe:
try:
print(...)
except Broken
On Thursday, March 10, 2016 at 9:28:06 AM UTC-6, Ian wrote:
> Encapsulation in Python is based on trust rather than the
> authoritarian style of C++ / Java. The maxim in the Python
> community is that "we're all consenting adults". If I
> don't intend an attribute to be messed with, then I'll
> ma
On Thursday, March 10, 2016 at 12:13:39 AM UTC-6, Rustom Mody wrote:
> As usual Rick I find myself agreeing with your direction [also it seems
> Random832's direction]
Somehow i missed Random's remark... Hmm, he does have a good idea! Introducing
a new "import statement" would not break anything
On 11/03/2016 00:05, BartC wrote:
On 10/03/2016 09:02, Rodrick Brown wrote:
From the following input
9
BANANA FRIES 12
POTATO CHIPS 30
APPLE JUICE 10
CANDY 5
APPLE JUICE 10
CANDY 5
CANDY 5
CANDY 5
POTATO CHIPS 30
I'm expecting the following output
BANANA FRIES 12
POTATO CHIPS 60
APPLE JUICE 2
On 11/03/2016 00:25, Ian Kelly wrote:
On Mar 10, 2016 5:15 PM, "Fillmore" wrote:
Here's another handy Perl regex which I am not sure how to translate to
Python.
I use it to avoid processing lines that contain funny chars...
if ($string =~ /[^[:print:]]/) {next OUTER;}
Python's re module
On 11/03/2016 01:21, Mark Lawrence wrote:
On 11/03/2016 00:05, BartC wrote:
def last(a):
return a[-1]
def init(a): # all except last element
return a[0:len(a)-1]
What is wrong with a[0:1] ?
The returns the head of the list. I need everything except the last
elem
On Thu, Mar 10, 2016 at 8:45 PM, BartC wrote:
> Any other way of traversing two lists in parallel?
zip
--
https://mail.python.org/mailman/listinfo/python-list
>>> for i in range(len(names)):
>>> print (names[i],totals[i])
>>
>> Always a code smell when range() and len() are combined.
>
> Any other way of traversing two lists in parallel?
Yes. Builtin function called 'zip'.
https://docs.python.org/3/library/functions.html#zip
Toy example:
im
On 11/03/2016 01:45, BartC wrote:
On 11/03/2016 01:21, Mark Lawrence wrote:
On 11/03/2016 00:05, BartC wrote:
def last(a):
return a[-1]
def init(a): # all except last element
return a[0:len(a)-1]
What is wrong with a[0:1] ?
The returns the head of the list. I ne
On 11/03/2016 01:56, Martin A. Brown wrote:
for i in range(len(names)):
print (names[i],totals[i])
Always a code smell when range() and len() are combined.
Any other way of traversing two lists in parallel?
Yes. Builtin function called 'zip'.
https://docs.python.org/3/library/fu
On Thu, Mar 10, 2016 at 4:05 PM, BartC wrote:
> Here's a rather un-Pythonic and clunky version. But it gives the expected
> results. (I've dispensed with file input, but that can easily be added
> back.)
>
> def last(a):
> return a[-1]
>
> def init(a): # all except last elemen
On 11/03/2016 02:03, Mark Lawrence wrote:
On 11/03/2016 01:45, BartC wrote:
On 11/03/2016 01:21, Mark Lawrence wrote:
On 11/03/2016 00:05, BartC wrote:
def last(a):
return a[-1]
def init(a): # all except last element
return a[0:len(a)-1]
What is wrong with a[0:1]
On Mar 10, 2016 6:33 PM, "Mark Lawrence" wrote:
>
> On 11/03/2016 00:25, Ian Kelly wrote:
>>
>> On Mar 10, 2016 5:15 PM, "Fillmore" wrote:
>>>
>>>
>>>
>>> Here's another handy Perl regex which I am not sure how to translate to
>>
>> Python.
>>>
>>>
>>> I use it to avoid processing lines that cont
On Fri, 11 Mar 2016 05:33 am, Neal Becker wrote:
> Is there a way to ensure resource cleanup with a construct such as:
>
> x = load (open ('my file', 'rb))
>
> Is there a way to ensure this file gets closed?
Depends on what you mean by "ensure". Have load() call the file's close
method may be g
On 03/09/2016 11:54 PM, Rustom Mody wrote:
[...]
In between these two extremes we have many possibilities
- ibus/gchar etc
- compose key
- alternate keyboard layouts
Using all these levels judiciously seems to me a good idea...
FWIW -- in Mint Linux you can select the compose key with the foll
On Fri, 11 Mar 2016 07:07 am, Chris Angelico wrote:
> You _need_ [emphasis in original] to make sure
> that you're thinking about text as text, and that means being aware of
> RTL vs LTR, combining characters, case conversions, collations, etc,
> etc, etc, all in terms of Unicode rather than as ei
1 - 100 of 105 matches
Mail list logo