Re: celery multi celery.exceptions.TimeoutError: The operation timed out

2020-09-26 Thread iMath
在 2020年9月21日星期一 UTC+8 下午8:02:44, 写道: > Op 21-09-2020 om 12:14 schreef iMath: > > Asked 3 days ago at > > https://stackoverflow.com/questions/63951696/celery-multi-celery-exceptions-timeouterror-the-operation-timed-out > > > > > > But nobody helped yet, any

Re: celery multi celery.exceptions.TimeoutError: The operation timed out

2020-09-21 Thread Menno Holscher
Op 21-09-2020 om 12:14 schreef iMath: Asked 3 days ago at https://stackoverflow.com/questions/63951696/celery-multi-celery-exceptions-timeouterror-the-operation-timed-out But nobody helped yet, anyone ? Did you see https://stackoverflow.com/questions/9769496/celery-received-unregistered-task

celery multi celery.exceptions.TimeoutError: The operation timed out

2020-09-21 Thread iMath
Asked 3 days ago at https://stackoverflow.com/questions/63951696/celery-multi-celery-exceptions-timeouterror-the-operation-timed-out But nobody helped yet, anyone ? -- https://mail.python.org/mailman/listinfo/python-list

celery multi celery.exceptions.TimeoutError: The operation timed out

2020-09-18 Thread iMath
ckends/base.py", line 696, in wait_for raise TimeoutError('The operation timed out.') celery.exceptions.TimeoutError: The operation timed out. >>> So what's wrong ? Test environment : - Python 3.8.2 - celery multi v4.4.7 - rabbitmqctl version --->3.

Solved: pip hangs after successful operation (sandboxed environment problem)

2018-10-05 Thread Ryan Johnson
It turns out that Comodo Antivirus auto-sandboxes any program that it doesn’t recognize, and this included python in the C:\Users\$user\AppData\Programs directory. This also affects Cygwin and MSYS2 (but not MSYS). If you are thinking about using Comodo, disable the Auto-Containment feature. A

pip hangs after successful operation

2018-10-04 Thread Ryan Johnson
Hello, I am seeking some quick help, and probably am reporting bugs along the way. I apologize that this is a long email. Please let me know what I should do in the future. On Windows, pip hangs and does not install packages in the proper location (or perhaps, at all), even if pip claims it ins

Re: Vectorizing operation involving multiple DataFrames

2018-07-05 Thread Viswanath Potluri
list of strings, for each row in Legs. > So, basically its like getting a dataframe that is subset of all_paths for > each row in Legs. Then I need to perform a math operation on the columns of > each subset and assign the values back to another column in all_paths. > Followin

Vectorizing operation involving multiple DataFrames

2018-07-04 Thread Viswanath Potluri
me that is subset of all_paths for each row in Legs. Then I need to perform a math operation on the columns of each subset and assign the values back to another column in all_paths. Following is my implementation def step1_vec(iti_list, idx): mask= all_paths.loc[all_paths['Path'].isi

Re: ValueError: I/O operation on closed file

2016-05-25 Thread Steven D'Aprano
On Thursday 26 May 2016 15:47, San wrote: > Following is the code i used. > > def test_results(filename): > import csv > with open(filename,"rU") as f: > reader = csv.reader(f,delimiter="\t") > result = {} You should use more consistent indents. Can you set your editor to auto

Re: ValueError: I/O operation on closed file

2016-05-25 Thread Rustom Mody
On Thursday, May 26, 2016 at 11:17:56 AM UTC+5:30, San wrote: > On Wednesday, May 25, 2016 at 6:00:07 PM UTC+5:30, San wrote: > > Hi Gorup, > > > > why i am getting "ValueError: I/O operation on closed file" this error. > > Pls let me know. > >

Re: ValueError: I/O operation on closed file

2016-05-25 Thread San
On Wednesday, May 25, 2016 at 6:00:07 PM UTC+5:30, San wrote: > Hi Gorup, > > why i am getting "ValueError: I/O operation on closed file" this error. > Pls let me know. > > Thanks in Advance. > san Hello, Following is the code i used. def test_results(filename

Re: ValueError: I/O operation on closed file

2016-05-25 Thread alister
On Wed, 25 May 2016 05:29:53 -0700, San wrote: > Hi Gorup, > > why i am getting "ValueError: I/O operation on closed file" this error. > Pls let me know. > > Thanks in Advance. > san because you are trying to do something with a file that has been closed the err

Re: ValueError: I/O operation on closed file

2016-05-25 Thread Joel Goldstick
On Wed, May 25, 2016 at 8:29 AM, San wrote: > Hi Gorup, > > why i am getting "ValueError: I/O operation on closed file" this error. > Pls let me know. Because your program is incorrect? Why not list your code, so that someone might be able to help you? > &

ValueError: I/O operation on closed file

2016-05-25 Thread San
Hi Gorup, why i am getting "ValueError: I/O operation on closed file" this error. Pls let me know. Thanks in Advance. san -- https://mail.python.org/mailman/listinfo/python-list

Re: what is the difference between one-line-operation and 2-line-operation

2016-04-25 Thread Gary Herron
On 04/25/2016 07:13 AM, oyster wrote: for a simple code [code] vexList = [1, 2, 3] print('vexList', list(vexList)) vexList=map(lambda e: e+1, vexList) print('vexList', list(vexList)) vexList = list(vexList) print('vexList', list(vexList)) vexList=map(lambda e: e*2,vexList) print('vexList', lis

Re: what is the difference between one-line-operation and 2-line-operation

2016-04-25 Thread Michael Torrie
On 04/25/2016 08:13 AM, oyster wrote: > so, what produces this difference between py2 and py3 in nature? is > there more examples? where can I find the text abiut his difference? One thing I see is that both your py2 and py3 examples are treating print as a function. It's only a function in Py3.

Re: what is the difference between one-line-operation and 2-line-operation

2016-04-25 Thread Jussi Piitulainen
oyster writes: - - > I found > type(map(lambda e: e, vexList)) is in py2 > type(map(lambda e: e, vexList)) is in py3 > > so, what produces this difference between py2 and py3 in nature? is > there more examples? where can I find the text abiut his difference? Yes, there are more ways obtain o

what is the difference between one-line-operation and 2-line-operation

2016-04-25 Thread oyster
for a simple code [code] vexList = [1, 2, 3] print('vexList', list(vexList)) vexList=map(lambda e: e+1, vexList) print('vexList', list(vexList)) vexList = list(vexList) print('vexList', list(vexList)) vexList=map(lambda e: e*2,vexList) print('vexList', list(vexList)) [/code] py27 says [quote]

Re: real usable file/directory operation module?

2015-12-10 Thread Cameron Simpson
On 11Dec2015 11:04, oyster wrote: there is shutil module, but I find it limits the user heavily. For example, I want to move 2 directories "a/scene" and "c/scene" to "d", but there is "scene" under d already. Then shutil.move will raise Error, "Destination path '%s' already exists" % real_dst S

real usable file/directory operation module?

2015-12-10 Thread oyster
there is shutil module, but I find it limits the user heavily. For example, I want to move 2 directories "a/scene" and "c/scene" to "d", but there is "scene" under d already. Then shutil.move will raise Error, "Destination path '%s' already exists" % real_dst So is there any module, which allow me

Potential Solution for AssertionError: invalid dtype determination in get_concat_dtype when concatenating operation on list of Dataframes?

2015-09-09 Thread kbtyo
I have a list of Pandas Dataframes that I am attempting to combine using the concatenation function. dataframe_lists = [df1, df2, df3] result = pd.concat(dataframe_lists, keys = ['one', 'two','three'], ignore_index=True) The full traceback that I receive when I execute this function is: -

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Steven D'Aprano
On Thu, 4 Jun 2015 11:18 am, Russell Brennan wrote: > I'm going to x-post this to stackoverflow but... > > When checking a method's arguments to see whether they were set, is it > pythonic to do an identity check: > > def doThis(arg1, arg2=None): > if arg2 is None: > arg2 = myClass() > >

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Peter Otten
Frank Millman wrote: > I have a slight variation in that I want to keep a reference to the > argument - > > def __init__(self, arg=None): > self.arg = arg or [] > > Based on your comment, I have changed it to - > > def __init__(self, arg=None): > self.arg = [] if arg is None else arg >

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Frank Millman
"Peter Otten" <__pete...@web.de> wrote in message news:mkp10p$n0l$1...@ger.gmane.org... > Russell Brennan wrote: > >> I'm going to x-post this to stackoverflow but... >> >> When checking a method's arguments to see whether they were set, is it >> pythonic to do an identity check: >> >> def doThis

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Peter Otten
Russell Brennan wrote: > I'm going to x-post this to stackoverflow but... > > When checking a method's arguments to see whether they were set, is it > pythonic to do an identity check: > > def doThis(arg1, arg2=None): > if arg2 is None: > arg2 = myClass() > > > Or is it proper form to us

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Ben Finney
Russell Brennan writes: > I'm going to x-post this to stackoverflow but... > > When checking a method's arguments to see whether they were set, is it > pythonic to do an identity check: > > def doThis(arg1, arg2=None): > if arg2 is None: > arg2 = myClass() That is the Pythonic way to test

Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Russell Brennan
I'm going to x-post this to stackoverflow but... When checking a method's arguments to see whether they were set, is it pythonic to do an identity check: def doThis(arg1, arg2=None): if arg2 is None: arg2 = myClass() Or is it proper form to use a short-circuiting boolean: def doThis(arg1

Re: seek operation in python

2015-04-30 Thread Larry Hudson
On 04/30/2015 01:50 PM, Cecil Westerhof wrote: Op Thursday 30 Apr 2015 21:38 CEST schreef Larry Hudson: On 04/30/2015 01:06 AM, Cecil Westerhof wrote: [snip] I wrote a module where I have: def get_indexed_message(message_filename, index): """ Get index message from a file, where 0 gets the fi

Re: seek operation in python

2015-04-30 Thread Cecil Westerhof
Op Thursday 30 Apr 2015 21:38 CEST schreef Larry Hudson: > On 04/30/2015 01:06 AM, Cecil Westerhof wrote: > [snip] > >> I wrote a module where I have: >> def get_indexed_message(message_filename, index): >> """ >> Get index message from a file, where 0 gets the first message >> """ >> >> return op

Re: seek operation in python

2015-04-30 Thread Larry Hudson
On 04/30/2015 01:06 AM, Cecil Westerhof wrote: [snip] I wrote a module where I have: def get_indexed_message(message_filename, index): """ Get index message from a file, where 0 gets the first message """ return open(expanduser(message_filename), 'r').r

Re: seek operation in python

2015-04-30 Thread Cecil Westerhof
Op Wednesday 29 Apr 2015 20:08 CEST schreef siva sankari R.: > file=open("input","r") > line=file.seek(7) > print line > > The above code is supposed to print a line but it prints "none". I > don't know where the mistake is. Help.! You could use my module: https://github.com/CecilWesterhof/P

Re: seek operation in python

2015-04-30 Thread Chris Angelico
On Thu, Apr 30, 2015 at 7:06 PM, Cecil Westerhof wrote: > I already done it. I thought it not to much work. And it even makes > some code shorter: > -marshal_file= open(expanduser(marshal_filename), 'r') > -not_list= load(marshal_file) > -marshal_file.close() > -return

Re: seek operation in python

2015-04-30 Thread Cecil Westerhof
Op Thursday 30 Apr 2015 10:31 CEST schreef Dave Angel: > On 04/30/2015 04:06 AM, Cecil Westerhof wrote: >> Op Thursday 30 Apr 2015 09:33 CEST schreef Chris Angelico: >> >>> On Thu, Apr 30, 2015 at 4:27 PM, Cecil Westerhof wrote: > with open("input.cpp") as f: > lines = f.readlines() >

Re: seek operation in python

2015-04-30 Thread Dave Angel
On 04/30/2015 04:06 AM, Cecil Westerhof wrote: Op Thursday 30 Apr 2015 09:33 CEST schreef Chris Angelico: On Thu, Apr 30, 2015 at 4:27 PM, Cecil Westerhof wrote: with open("input.cpp") as f: lines = f.readlines() print(lines[7]) Is the following not better: print(open('input.cpp', 'r').read

Re: seek operation in python

2015-04-30 Thread Cecil Westerhof
Op Thursday 30 Apr 2015 09:33 CEST schreef Chris Angelico: > On Thu, Apr 30, 2015 at 4:27 PM, Cecil Westerhof wrote: >>> with open("input.cpp") as f: >>> lines = f.readlines() >>> print(lines[7]) >> >> Is the following not better: >> print(open('input.cpp', 'r').readlines()[7]) >> >> Time is the

Re: seek operation in python

2015-04-30 Thread Chris Angelico
On Thu, Apr 30, 2015 at 4:27 PM, Cecil Westerhof wrote: >> with open("input.cpp") as f: >> lines = f.readlines() >> print(lines[7]) > > Is the following not better: > print(open('input.cpp', 'r').readlines()[7]) > > Time is the same (about 25 seconds for 100.000 calls), but I find this > more

Re: seek operation in python

2015-04-29 Thread Cecil Westerhof
Op Thursday 30 Apr 2015 02:33 CEST schreef Chris Angelico: > On Thu, Apr 30, 2015 at 4:08 AM, siva sankari R > wrote: >> file=open("input","r") >> line=file.seek(7) >> print line >> >> The above code is supposed to print a line but it prints "none". I >> don't know where the mistake is. Help.! >

Re: seek operation in python

2015-04-29 Thread Chris Angelico
On Thu, Apr 30, 2015 at 4:08 AM, siva sankari R wrote: > file=open("input","r") > line=file.seek(7) > print line > > The above code is supposed to print a line but it prints "none". I don't know > where the mistake is. Help.! Going right back to the beginning... Are you aware that 'seek' works w

Re: seek operation in python

2015-04-29 Thread Steven D'Aprano
On Thu, 30 Apr 2015 06:53 am, Mark Lawrence wrote: > The only good top poster is a dead top poster, except for... Since you just top posted, at least you're being honest. Mark, I'm fairly sure you were trying to be funny, but I think you just crossed a line from "funny and mean" to "just mean bu

Re: seek operation in python

2015-04-29 Thread Mark Lawrence
The only good top poster is a dead top poster, except for... On 29/04/2015 19:42, Billy Earney wrote: if your filename is input.cpp, you first line of code should be: file=open("input*.cpp*","r") On Wed, Apr 29, 2015 at 1:26 PM, siva sankari R wrote: There is a file named "input.cpp"(c++ fi

Re: seek operation in python

2015-04-29 Thread John Gordon
stake is. Help.! The seek() function doesn't return any data; it just relocates the file pointer. You still have to do a read operation to get data from the new location. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch &

Re: seek operation in python

2015-04-29 Thread MRAB
On 2015-04-29 19:08, siva sankari R wrote: file=open("input","r") line=file.seek(7) print line The above code is supposed to print a line but it prints "none". I don't know where the mistake is. Help.! 'seek' will seek to position 7 in the file. It doesn't read. That's what 'read' is for! :-)

Re: seek operation in python

2015-04-29 Thread Billy Earney
if your filename is input.cpp, you first line of code should be: file=open("input*.cpp*","r") On Wed, Apr 29, 2015 at 1:26 PM, siva sankari R wrote: > There is a file named "input.cpp"(c++ file) that contains some 80 lines of > code. > -- > https://mail.python.org/mailman/listinfo/python-list >

Re: seek operation in python

2015-04-29 Thread siva sankari R
There is a file named "input.cpp"(c++ file) that contains some 80 lines of code. -- https://mail.python.org/mailman/listinfo/python-list

Re: seek operation in python

2015-04-29 Thread Joel Goldstick
On Wed, Apr 29, 2015 at 2:08 PM, siva sankari R wrote: > file=open("input","r") > line=file.seek(7) > print line > > The above code is supposed to print a line but it prints "none". I don't know > where the mistake is. Help.! > -- > https://mail.python.org/mailman/listinfo/python-list What is in

seek operation in python

2015-04-29 Thread siva sankari R
file=open("input","r") line=file.seek(7) print line The above code is supposed to print a line but it prints "none". I don't know where the mistake is. Help.! -- https://mail.python.org/mailman/listinfo/python-list

Re: how to write a function to make operation as a argument in the function

2014-08-14 Thread Mark Lawrence
On 14/08/2014 08:32, luofeiyu wrote: I want to write a function to make operation as a argument in the function. |def fun(op,x,y): return(x op y)| it is my target for the funciton: if op ="+" fun(op,3,9) =12 if op ="*" fun(op,3,9) =27 How to write it? With

how to write a function to make operation as a argument in the function

2014-08-14 Thread luofeiyu
I want to write a function to make operation as a argument in the function. |def fun(op,x,y): return(x op y)| it is my target for the funciton: if op ="+" fun(op,3,9) =12 if op ="*" fun(op,3,9) =27 How to write it? -- https://mail.python.org/mailman/listinfo/python-list

Re: the logical operation confused me

2014-04-10 Thread Denis McMahon
On Fri, 11 Apr 2014 07:02:33 +0800, length power wrote: "ok" or "not ok" > 'ok' "ok" and "not ok" > 'not ok' > why "ok" or "not ok" output "ok" , "ok" and "not ok" output "not ok" ? I believe that: [ (falsey condition) or ]* (first truthy condition) or (any condition) [ or

Re: the logical operation confused me

2014-04-10 Thread Gary Herron
On 04/10/2014 04:02 PM, length power wrote: >>> "ok" or "not ok" 'ok' >>> "ok" and "not ok" 'not ok' >>> why "ok" or "not ok" output "ok" , "ok" and "not ok" output "not ok" ? You are probably confusing yourself with the string "not ok". That string, and any other non-empty string is co

Re: the logical operation confused me

2014-04-10 Thread Terry Reedy
On 4/10/2014 7:02 PM, length power wrote: >>> "ok" or "not ok" 'ok' >>> "ok" and "not ok" 'not ok' >>> why "ok" or "not ok" output "ok" , "ok" and "not ok" output "not ok" ? This is explained in our fine manual. https://docs.python.org/2/reference/expressions.html#boolean-operations -- T

the logical operation confused me

2014-04-10 Thread length power
>>> "ok" or "not ok" 'ok' >>> "ok" and "not ok" 'not ok' >>> why "ok" or "not ok" output "ok" , "ok" and "not ok" output "not ok" ? -- https://mail.python.org/mailman/listinfo/python-list

Re: Python solve problem with string operation

2014-01-16 Thread Asaf Las
inpu = "3443331123377" tstr = inpu[0] for k in range(1, len(inpu)): if inpu[k] != inpu[k-1] : tstr = tstr + inpu[k] print(tstr) -- https://mail.python.org/mailman/listinfo/python-list

Re: Python solve problem with string operation

2014-01-16 Thread Rhodri James
On Thu, 16 Jan 2014 22:24:40 -, Nac Temha wrote: Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input : "3443331123377" operation-> (3)(44)()(333)(11)(2)(33)(77) output: "3413

Re: Python solve problem with string operation

2014-01-16 Thread giacomo boffi
giacomo boffi writes: > % python a.py > 34131237 % cat a.py i="3443331123377";n=0 while n+1!=len(i):i,n=(i[:n]+i[n+1:],n) if i[n+1]==i[n] else (i,n+1) print i % python a.py 34131237 % -- for Nikos -- https://mail.python.org/mailman/listinfo/python-list

Re: Python solve problem with string operation

2014-01-16 Thread Denis McMahon
On Fri, 17 Jan 2014 00:24:40 +0200, Nac Temha wrote: > Hi everyone, > > I want to do operation with chars in the given string. Actually I want > to grouping the same chars. > > For example; > > input : "34411113331123377" > operation-> (3)(44

Re: Python solve problem with string operation

2014-01-16 Thread giacomo boffi
Nac Temha writes: > Hi everyone, > > I want to do operation with chars in the given string. Actually I want to > grouping the same chars. > > For example; > > input : "34411113331123377" > operation-> (3)(44)()(333)(11)(2)(33)(77) > outp

Re: Python solve problem with string operation

2014-01-16 Thread John Gordon
In Mark Lawrence writes: > > input = "3443331123377" > > output = [] > > previous_ch = None > > for ch in input: > > if ch != previous_ch: > > output.append(ch) > > previous_ch = ch > > print ''.join(output) > > > Cheat, you've used a list :) Ack! I missed that

Re: Python solve problem with string operation

2014-01-16 Thread Mark Lawrence
On 16/01/2014 22:30, John Gordon wrote: In Nac Temha writes: --047d7b6d95d0367a3d04f01de490 Content-Type: text/plain; charset=ISO-8859-1 Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input

Re: Python solve problem with string operation

2014-01-16 Thread Tim Chase
On 2014-01-17 00:24, Nac Temha wrote: > Hi everyone, > > I want to do operation with chars in the given string. Actually I > want to grouping the same chars. > > For example; > > input : "34411113331123377" > operation-> (3)(44)()(333)(11)(

Re: Python solve problem with string operation

2014-01-16 Thread John Gordon
In Nac Temha writes: > --047d7b6d95d0367a3d04f01de490 > Content-Type: text/plain; charset=ISO-8859-1 > Hi everyone, > I want to do operation with chars in the given string. Actually I want to > grouping the same chars. > For example; > input : "344333112

Python solve problem with string operation

2014-01-16 Thread Nac Temha
Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input : "3443331123377" operation-> (3)(44)()(333)(11)(2)(33)(77) output: "34131237" How can I do without list, regular expres

Re: ssl handshake operation timed out on Python 3.3.2

2013-07-09 Thread Benedict Verheyen
Op Tue, 09 Jul 2013 10:08:01 +, schreef Antoine Pitrou: > This may be a IIS-specific problem. > Take a look at > http://stackoverflow.com/questions/16365483/iis-7-5-mercurial-setup- ignoring-maxallowedcontentlength > http://bz.selenic.com/show_bug.cgi?id=3905 > http://bugs.python.org/issue179

Re: ssl handshake operation timed out on Python 3.3.2

2013-07-09 Thread Antoine Pitrou
rewall, the traffic passes without a problem. > > The error I get is that the SSL handshake operation timed out. > I tried some code that specifies the ssl protocol but the results are the > same. This may be a IIS-specific problem. Take a look at http://stackoverflow.com/questions/16365483/

ssl handshake operation timed out on Python 3.3.2

2013-07-08 Thread Benedict Verheyen
, the code works with Python 2.7.3 but not with Python 3.3.2. Another difference is that the testserver has a direct ip, so nothing in between the machine and the internet. I checked the firewall, the traffic passes without a problem. The error I get is that the SSL handshake operation timed o

Re: ValueError: I/O operation on closed file. with python3

2013-06-12 Thread Serhiy Storchaka
12.06.13 10:26, Peter Otten написав(ла): @contextmanager def my_urlopen(url): resp = urlopen(url) yield io.TextIOWrapper(resp.fp) with urlopen(url) as resp: yield io.TextIOWrapper(resp) Note that last bugfix releases (i.e. 3.3.1) are needed. There was a

Re: ValueError: I/O operation on closed file. with python3

2013-06-12 Thread Adam Mercer
On Wed, Jun 12, 2013 at 2:26 AM, Peter Otten <__pete...@web.de> wrote: > Applying these findings to your script: > > from contextlib import contextmanager > try: > # python-2.x > from urllib2 import urlopen > from ConfigParser import ConfigParser > > @contextmanager > def my_urlopen(url)

Re: ValueError: I/O operation on closed file. with python3

2013-06-12 Thread Peter Otten
.read_file(fp, source=filename) > File > "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/configparser.py", > line 708, in read_file > self._read(f, source) > File > "/opt/local/Library/Frameworks/Python.framework/Versions/

ValueError: I/O operation on closed file. with python3

2013-06-11 Thread Adam Mercer
ry/Frameworks/Python.framework/Versions/3.3/lib/python3.3/configparser.py", line 1010, in _read for lineno, line in enumerate(fp, start=1): ValueError: I/O operation on closed file. $ Is there a way to get this working in both python2 and python3? This is a small script and I'm s

Re: Sum operation in numpy arrays

2013-05-02 Thread Steven D'Aprano
On Thu, 02 May 2013 02:10:11 -0700, Ana Dionísio wrote: > Hello! I have several numpy arrays in my script and i want to add them. > For example: > > a=[1,2,3,4,5] > b=[1,1,1,1,1] > c=[1,0,1,0,1] These are not numpy arrays, they are lists of ints. Based on the error message you quote: TypeError

Re: Sum operation in numpy arrays

2013-05-02 Thread Jens Thoms Toerring
Ana Dionísio wrote: > Hello! I have several numpy arrays in my script and i want to add them. For > example: > a=[1,2,3,4,5] > b=[1,1,1,1,1] > c=[1,0,1,0,1] > for i in range(5): > d[i]=a[i]+b[i]+c[i] > print d > [3,3,5,5,7] > I did it like that but I get an error: "TypeError: unsupported

Sum operation in numpy arrays

2013-05-02 Thread Ana Dionísio
Hello! I have several numpy arrays in my script and i want to add them. For example: a=[1,2,3,4,5] b=[1,1,1,1,1] c=[1,0,1,0,1] for i in range(5): d[i]=a[i]+b[i]+c[i] print d [3,3,5,5,7] I did it like that but I get an error: "TypeError: unsupported operand type(s) for +: 'float' and 'num

Re: numpy array operation

2013-01-29 Thread Terry Reedy
On 1/29/2013 1:49 PM, Alok Singhal wrote: On Tue, 29 Jan 2013 00:41:54 -0800, C. Ng wrote: Is there a numpy operation that does the following to the array? 1 2 ==> 4 3 3 4 2 1 Thanks in advance. How about: import numpy as np a = np.array([[1,2],[3,4]]) a array([[1, 2], [3

Re: numpy array operation

2013-01-29 Thread Alok Singhal
On Tue, 29 Jan 2013 00:41:54 -0800, C. Ng wrote: > Is there a numpy operation that does the following to the array? > > 1 2 ==> 4 3 > 3 4 2 1 > > Thanks in advance. How about: >>> import numpy as np >>> a = np.array([[1,2],[3,4]]) >>> a

Re: numpy array operation

2013-01-29 Thread Tim Williams
On Tuesday, January 29, 2013 3:41:54 AM UTC-5, C. Ng wrote: > Is there a numpy operation that does the following to the array? > > > > 1 2 ==> 4 3 > > 3 4 2 1 > > > > Thanks in advance. >>> import numpy as np >>> a=np.

Re: numpy array operation

2013-01-29 Thread Peter Otten
C. Ng wrote: > Is there a numpy operation that does the following to the array? > > 1 2 ==> 4 3 > 3 4 2 1 How about >>> a array([[1, 2], [3, 4]]) >>> a[::-1].transpose()[::-1].transpose() array([[4, 3], [2, 1]]) Or did you mean >&

numpy array operation

2013-01-29 Thread C. Ng
Is there a numpy operation that does the following to the array? 1 2 ==> 4 3 3 4 2 1 Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: overriding equals operation

2012-10-20 Thread Joshua Landau
On 17 October 2012 09:14, Mark Lawrence wrote: > On 17/10/2012 05:16, 8 Dihedral wrote: > >> What you really want is b=a.copy() >> not b=a to disentangle two objects. >> >> __eq__ is used in the comparison operation. >> >> > The winner Smartest An

Re: overriding equals operation

2012-10-17 Thread Mark Lawrence
On 17/10/2012 05:16, 8 Dihedral wrote: What you really want is b=a.copy() not b=a to disentangle two objects. __eq__ is used in the comparison operation. The winner Smartest Answer by a Bot Award 2012 :) -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: overriding equals operation

2012-10-16 Thread 88888 Dihedral
; > > > > Now if I try: > > > > >>> a=myclass() > > >>> a.name = 'test' > > >>> b=a > What you really want is b=a.copy() not b=a to disentangle two objects. __eq__ is used in the comparison operation. > &

Re: overriding equals operation

2012-10-16 Thread Dwight Hutto
On Tue, Oct 16, 2012 at 9:51 AM, Pradipto Banerjee wrote: > I am trying to define class, where if I use a statement a = b, then instead > of "a" pointing to the same instance as "b", it should point to a copy of > "b", but I can't get it right. > > Currently, I have the following: > > > > c

Re: overriding equals operation

2012-10-16 Thread Nobody
On Tue, 16 Oct 2012 08:51:46 -0500, Pradipto Banerjee wrote: > I am trying to define class, where if I use a statement a = b, then > instead of "a" pointing to the same instance as "b", it should point to a > copy of "b", but I can't get it right. It cannot be done. Name binding ("variable = val

Re: overriding equals operation

2012-10-16 Thread Thomas Rachel
Am 16.10.2012 15:51 schrieb Pradipto Banerjee: I am trying to define class, where if I use a statement a = b, then instead of "a" pointing to the same instance as "b", it should point to a copy of "b", but I can't get it right. This is not possible. Currently, I have the following:

Re: overriding equals operation

2012-10-16 Thread Dave Angel
On 10/16/2012 09:51 AM, Pradipto Banerjee wrote: > I am trying to define class, where if I use a statement a = b, then instead > of "a" pointing to the same instance as "b", it should point to a copy of > "b", but I can't get it right. > > The __eq__ method is called for equals comparison, like

overriding equals operation

2012-10-16 Thread Pradipto Banerjee
I am trying to define class, where if I use a statement a = b, then instead of "a" pointing to the same instance as "b", it should point to a copy of "b", but I can't get it right. Currently, I have the following: class myclass(object): def __init__(self, name='')

Re: Doing a HTTP DELETE operation with urllib2?

2011-12-30 Thread Dave Angel
On 12/30/2011 03:37 PM, Steven D'Aprano wrote: On Fri, 30 Dec 2011 10:57:06 -0800, Roy Smith wrote: Ah, cool. I didn't know you could do that. Thanks. Who are you talking to, and what is "that"? Replies with no context are somewhat less than useful. It might have made sense in your head whe

Re: Doing a HTTP DELETE operation with urllib2?

2011-12-30 Thread Steven D'Aprano
On Fri, 30 Dec 2011 10:57:06 -0800, Roy Smith wrote: > Ah, cool. I didn't know you could do that. Thanks. Who are you talking to, and what is "that"? Replies with no context are somewhat less than useful. It might have made sense in your head when you wrote the reply, but to those reading, it

Re: Doing a HTTP DELETE operation with urllib2?

2011-12-30 Thread Roy Smith
Ah, cool. I didn't know you could do that. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Doing a HTTP DELETE operation with urllib2?

2011-12-30 Thread Douglas Landgraf
Hi, On 12/30/2011 12:01 PM, Roy Smith wrote: Is there some way to make urllib2.urlopen() perform a DELETE instead of a GET or POST? I'm hoping I don't have to dip way down into httplib. I've got an application test framework built on top of urllib2. It makes heavy use of HTTPCookieProces

Doing a HTTP DELETE operation with urllib2?

2011-12-30 Thread Roy Smith
Is there some way to make urllib2.urlopen() perform a DELETE instead of a GET or POST? I'm hoping I don't have to dip way down into httplib. I've got an application test framework built on top of urllib2. It makes heavy use of HTTPCookieProcessor. If I need to use the httplib calls directly

Re: "socket operation on non socket" on Windows

2011-01-11 Thread wiz1024 wiz1024
t;, line 860, in endheaders self._send_output() File "C:\Python25\lib\httplib.py", line 732, in _send_output self.send(msg) File "C:\Python25\lib\httplib.py", line 699, in send self.connect() File "C:\Python25\lib\httplib.py", line 683, in connect

Re: "socket operation on non socket" on Windows

2011-01-11 Thread Terry Reedy
On 1/11/2011 6:18 AM, wiz1024 wiz1024 wrote: Hi I have a problem on Windows with the module urllib2 with python 2.5 when i use the "urlopen" function, i have some time the following error : error I don't understand why suddenly this error arrives The urlopen function is called from a thread

"socket operation on non socket" on Windows

2011-01-11 Thread wiz1024 wiz1024
Hi I have a problem on Windows with the module urllib2 with python 2.5 when i use the "urlopen" function, i have some time the following error : error I don't understand why suddenly this error arrives The urlopen function is called from a thread Thanks in advance. -- http://mail.python.org/

Re: Unknown function operation deciphering, exercise in readability by program reasoning

2010-12-05 Thread small Pox
On Dec 4, 11:37 pm, Madhu wrote: > * jvt <5e1f79ab-5432-4f18-b896-362b7406c...@i18g2000yqn.googlegroups.com> : > Wrote on Sat, 4 Dec 2010 19:34:53 -0800 (PST): > > | > | I think this is correct: > | > | > | (defun unknown-function (sym0) > |   (let (sym1 sym2) > |       (while (or sym2 sym0) > |  

Re: Unknown function operation deciphering, exercise in readability by program reasoning

2010-12-05 Thread small Pox
> > Thank emacs, not me. > > Lisp? Still can't read it... ;-)- Hide quoted text - > This is because madhu did not explain how he reasoned. Does it appear to you that she broke first two rules. its a list flattener that also reverses the operation. it appears that she took the

Re: Unknown function operation deciphering, exercise in readability by program reasoning

2010-12-05 Thread rupertlssm...@googlemail.com
On Dec 5, 3:34 am, jvt wrote: > On Dec 4, 4:49 pm, Barb Knox wrote: > > > > > > > In article > > <46365e1d-42d8-4b3b-8e69-941472467...@u25g2000pra.googlegroups.com>, > >  small Pox wrote: > > > > Rules : > > > No need to add any additional hurdles -- the code as presented is > > thoroughly unrea

Re: Unknown function operation deciphering, exercise in readability by program reasoning

2010-12-04 Thread jvt
On Dec 4, 4:49 pm, Barb Knox wrote: > In article > <46365e1d-42d8-4b3b-8e69-941472467...@u25g2000pra.googlegroups.com>, >  small Pox wrote: > > > Rules : > > No need to add any additional hurdles -- the code as presented is > thoroughly unreadable by humans. > > > @1@  No execution of the functio

Re: Unknown function operation deciphering, exercise in readability by program reasoning

2010-12-04 Thread Barb Knox
In article <46365e1d-42d8-4b3b-8e69-941472467...@u25g2000pra.googlegroups.com>, small Pox wrote: > Rules : No need to add any additional hurdles -- the code as presented is thoroughly unreadable by humans. > @1@ No execution of the function, only checking syntax What about "desk checking"

Unknown function operation deciphering, exercise in readability by program reasoning

2010-12-03 Thread small Pox
Rules : @1@ No execution of the function, only checking syntax @2@ No profiling using a debugger or profiler @3@ Editing allowed to make simpler variables (defun unknown-function (nano-thermite-911-FBI-fat-per-diem-bustards- kept-their-odious-mouth-shut-on-anthrax-and-911-lie) (let (BERNA

Re: Time and date operation

2010-11-23 Thread Chris Rebert
> -Original Message- > From: c...@rebertia.com [mailto: c...@rebertia.com] > Sent: 2010年11月23日 19:12 > To: huisky > Cc: python-list@python.org > Subject: Re: Time and date operation > > On Tue, Nov 23, 2010 at 9:47 AM, huisky wrote: >> Hi everyone, >>

  1   2   3   >