[issue24438] Strange behaviour when multiplying imaginary inf by 1

2015-06-12 Thread Mark Dickinson
Mark Dickinson added the comment: There's no bug here: as Steven explained, this is simply the result of the usual arithmetic conversions when performing a mixed-type operation. Python should multiply a complex by a non-complex in the simple way I think this would just be adding unnecessary

[issue11204] re module: strange behaviour of space inside {m, n}

2014-09-14 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - rejected stage: - resolved status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11204 ___

Re: Strange behaviour with a for loop.

2014-01-04 Thread Sean Murphy
Chris, Thanks for the tip on the function. I was not aware of that function, Grin. Creating the function as you mention makes a lot of sense. I am doing a lot of little bits and pieces focusing on things I need to eventually build a script that is going to compile data from a router and

Re: Strange behaviour with a for loop.

2014-01-04 Thread Chris Angelico
On Sat, Jan 4, 2014 at 8:52 PM, Sean Murphy mhysnm1...@gmail.com wrote: Thanks for the tip on the function. I was not aware of that function, Grin. Creating the function as you mention makes a lot of sense. I am doing a lot of little bits and pieces focusing on things I need to eventually

Re: Strange behaviour with a for loop.

2014-01-04 Thread Larry Hudson
On 01/03/2014 08:03 PM, Sean Murphy wrote: Hello all. This is a newly question. But I wish to understand why the below code is providing different results. import os, sys if len(sys.argv) 2: filenames = sys.argv[1:] else print (no parameters provided\n) sys.edit() for filename in

Re: Strange behaviour with a for loop.

2014-01-04 Thread Larry Hudson
On 01/03/2014 10:32 PM, Sean Murphy wrote: Hi everyone. [snip] The 2nd part of my original question still stands. I will expand upon this a bit more to give more context. I want to print from the beginning of the paragraph to the end. Each paragraph ends with \n\n\n. If I use \n\n\n in

Strange behaviour with a for loop.

2014-01-03 Thread Sean Murphy
Hello all. This is a newly question. But I wish to understand why the below code is providing different results. import os, sys if len(sys.argv) 2: filenames = sys.argv[1:] else print (no parameters provided\n) sys.edit() for filename in filenames: print (filename is: %s\n

Re: Strange behaviour with a for loop.

2014-01-03 Thread Larry Martell
On Fri, Jan 3, 2014 at 11:03 PM, Sean Murphy mhysnq1...@icloud.com wrote: Hello all. This is a newly question. But I wish to understand why the below code is providing different results. import os, sys if len(sys.argv) 2: filenames = sys.argv[1:] else print (no parameters

Re: Strange behaviour with a for loop.

2014-01-03 Thread Chris Angelico
On Sat, Jan 4, 2014 at 3:03 PM, Sean Murphy mhysnq1...@icloud.com wrote: filenames = sys.argv[1:] for filename in filenames: print (filename is: %s\n %filename) versus filenames = sys.argv[1] for filename in filenames: print (filename is: %s\n % filename) The first one is

Re: Strange behaviour with a for loop.

2014-01-03 Thread Mark Lawrence
On 04/01/2014 04:03, Sean Murphy wrote: Hello all. This is a newly question. But I wish to understand why the below code is providing different results. import os, sys if len(sys.argv) 2: filenames = sys.argv[1:] else print (no parameters provided\n) sys.edit() for filename in

Re: Strange behaviour with a for loop.

2014-01-03 Thread Sean Murphy
Thanks everyone. Mark thanks for the correction on the ':'. Since I didn't cut and copy, rather typed it out. Errors crept in. :-) another question in relation to slicing strings. If you want to get a single character, just using the index position will get it. If I use the following,

Re: Strange behaviour with a for loop.

2014-01-03 Thread Sean Murphy
Hi everyone. Worked out what I was doing wrong with the string splicing. The offset number was lower then the index number, so it was failing. E.G: On 04/01/2014, at 4:54 PM, Sean Murphy mhysnm1...@gmail.com wrote: Thanks everyone. Mark thanks for the correction on the ':'. Since I

Re: Strange behaviour with a for loop.

2014-01-03 Thread Chris Angelico
On Sat, Jan 4, 2014 at 5:32 PM, Sean Murphy mhysnm1...@gmail.com wrote: So I suspect the offset number still starts at the beginning of the string and counts forward or another way to look at it you are slicing from element x to element y. If element y is less then element x, return nothing.

Re: Strange behaviour with a for loop.

2014-01-03 Thread Cameron Simpson
On 04Jan2014 16:54, Sean Murphy mhysnm1...@gmail.com wrote: Thanks everyone. Mark thanks for the correction on the ':'. Since I didn't cut and copy, rather typed it out. Errors crept in. :-) another question in relation to slicing strings. If you want to get a single character, just

[issue19787] Fix PyThread_set_key_value() strange behaviour

2013-12-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5d078b0bae75 by Victor Stinner in branch 'default': Issue #19787: PyThread_set_key_value() now always set the value http://hg.python.org/cpython/rev/5d078b0bae75 -- ___ Python tracker

[issue19787] Fix PyThread_set_key_value() strange behaviour

2013-12-13 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19787 ___

[issue19787] Fix PyThread_set_key_value() strange behaviour

2013-12-12 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- title: tracemalloc: set_reentrant() should not have to call PyThread_delete_key() - Fix PyThread_set_key_value() strange behaviour ___ Python tracker rep...@bugs.python.org http

[issue19787] Fix PyThread_set_key_value() strange behaviour

2013-12-12 Thread STINNER Victor
STINNER Victor added the comment: Oh, my change on PyThread_set_key_value() has an unexpected effect on _testcapi.run_in_subinterp(): it now fixes the Python thread state. Py_NewInterpreter() creates a second Python thread state for the current thread, but PyThread_set_key_value() ignored the

[issue19787] Fix PyThread_set_key_value() strange behaviour

2013-12-12 Thread STINNER Victor
STINNER Victor added the comment: My commit broke test_capi, so I revert it. Here is the commit as a patch. The impact on subinterpreters is more complex than what I expected. A decision should be take on what to do: mimic behaviour of Python 3.3 for subinterpreters (don't replace the Python

[issue11204] re module: strange behaviour of space inside {m, n}

2013-10-27 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11204 ___ ___

Re: Strange behaviour with os.linesep

2013-07-24 Thread Vincent Vande Vyvre
Le 23/07/2013 17:25, Steven D'Aprano a écrit : On Tue, 23 Jul 2013 13:42:13 +0200, Vincent Vande Vyvre wrote: On Windows a script where de endline are the system line sep, the files are open with a double line in Eric4, Notepad++ or Gedit but they are correctly displayed in the MS Bloc-Notes.

Re: Strange behaviour with os.linesep

2013-07-24 Thread Chris Angelico
On Wed, Jul 24, 2013 at 5:02 PM, Vincent Vande Vyvre vincent.vandevy...@swing.be wrote: In fact, in my code, the original file is open in binary mode, the line separator is translate to \n and it is parsed by the module tokenise. I'm not a Windows user but my code must be run also on Win, this

Re: Strange behaviour with os.linesep

2013-07-24 Thread Terry Reedy
On 7/23/2013 7:41 PM, Dennis Lee Bieber wrote: On 23 Jul 2013 15:25:12 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info declaimed the following: On Tue, 23 Jul 2013 13:42:13 +0200, Vincent Vande Vyvre wrote: On Windows a script where de endline are the system line sep, the files are

Re: Strange behaviour with os.linesep

2013-07-23 Thread Steven D'Aprano
On Tue, 23 Jul 2013 13:42:13 +0200, Vincent Vande Vyvre wrote: On Windows a script where de endline are the system line sep, the files are open with a double line in Eric4, Notepad++ or Gedit but they are correctly displayed in the MS Bloc-Notes. I suspect the problem lies with Eric4,

Strange behaviour with os.linesep

2013-07-23 Thread Vincent Vande Vyvre
On Windows a script where de endline are the system line sep, the files are open with a double line in Eric4, Notepad++ or Gedit but they are correctly displayed in the MS Bloc-Notes. Example with this code: -- # -*- coding: utf-8 -*- import os

Re: Strange behaviour with os.linesep

2013-07-23 Thread Jason Swails
On Tue, Jul 23, 2013 at 7:42 AM, Vincent Vande Vyvre vincent.vandevy...@swing.be wrote: On Windows a script where de endline are the system line sep, the files are open with a double line in Eric4, Notepad++ or Gedit but they are correctly displayed in the MS Bloc-Notes. Example with this

Re: Strange behaviour with os.linesep

2013-07-23 Thread Vincent Vande Vyvre
Le 23/07/2013 14:39, Jason Swails a écrit : On Tue, Jul 23, 2013 at 7:42 AM, Vincent Vande Vyvre vincent.vandevy...@swing.be mailto:vincent.vandevy...@swing.be wrote: On Windows a script where de endline are the system line sep, the files are open with a double line in Eric4,

Re: Strange behaviour with os.linesep

2013-07-23 Thread Vincent Vande Vyvre
Le 23/07/2013 15:10, Vincent Vande Vyvre a écrit : The '\n' are in the original file. I've tested these other versions: --- def write(): strings = ['# -*- coding: utf-8 -*-\n', 'import os\n', 'import sys\n'] with

Re: Strange behaviour with os.linesep

2013-07-23 Thread Jason Swails
On Tue, Jul 23, 2013 at 9:26 AM, Vincent Vande Vyvre vincent.vandevy...@swing.be wrote: Le 23/07/2013 15:10, Vincent Vande Vyvre a écrit : The '\n' are in the original file. I've tested these other versions: --**- def write(): strings = ['# -*- coding:

[issue18127] Strange behaviour with default list argument

2013-06-03 Thread Poul-Henning Kamp
] [2] but I get: [1] [1, 2] Bug? (If not, I'd *love* to read the rationale for this behaviour...) -- messages: 190557 nosy: bsdphk priority: normal severity: normal status: open title: Strange behaviour with default list argument type: behavior versions: Python 2.7, Python 3.2

[issue18127] Strange behaviour with default list argument

2013-06-03 Thread Eric V. Smith
Eric V. Smith added the comment: It's by design. Search for mutable default arguments, for example http://docs.python-guide.org/en/latest/writing/gotchas.html#mutable-default-arguments -- nosy: +eric.smith resolution: - invalid stage: - committed/rejected status: open - closed

[issue18127] Strange behaviour with default list argument

2013-06-03 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: While it's true that it can be confusing to users, it's not a bug. http://docs.python.org/2/reference/compound_stmts.html#function and a nice treatise on the subject by the Effbot: http://effbot.org/zone/default-values.htm -- nosy: +barry

[issue11204] re module: strange behaviour of space inside {m, n}

2013-02-11 Thread Roy Smith
Changes by Roy Smith r...@panix.com: -- nosy: +roysmith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11204 ___ ___ Python-bugs-list mailing list

[issue11204] re module: strange behaviour of space inside {m, n}

2013-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Then let's leave all as is. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11204 ___ ___ Python-bugs-list

[issue11204] re module: strange behaviour of space inside {m, n}

2012-12-02 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- components: +Library (Lib), Regular Expressions nosy: +mrabarnett type: - behavior versions: +Python 3.2, Python 3.3, Python 3.4 -Python 3.1 ___ Python tracker rep...@bugs.python.org

[issue11204] re module: strange behaviour of space inside {m, n}

2012-12-02 Thread Matthew Barnett
Matthew Barnett added the comment: Interesting. In my regex module (http://pypi.python.org/pypi/regex) I have: bool(regex.match(pat, bb, regex.VERBOSE)) # True bool(regex.match(pat, b{1,3}, regex.VERBOSE)) # False because I thought that when the VERBOSE flag is turned on it should ignore

[issue11204] re module: strange behaviour of space inside {m, n}

2012-12-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: $ echo 'baaa' | grep -o 'b\{1,3\}a' bbba $ echo 'baaa' | grep -o 'b\{1, 3\}a' grep: Invalid content of \{\} $ echo 'baaa' | egrep -o 'b{1,3}a' bbba $ echo 'baaa' | egrep -o 'b{1, 3}a' $ echo 'bbb{1, 3}aa' | LC_ALL=C egrep -o 'b{1, 3}a' b{1, 3}a

[issue11204] re module: strange behaviour of space inside {m, n}

2012-12-02 Thread Matthew Barnett
Matthew Barnett added the comment: The question is whether re should always treat 'b{1, 3}a' as a literal, even with the VERBOSE flag. I've checked with Perl 5.14.2, and it agrees with re: adding a space _always_ makes it a literal, even with the 'x' flag (/b{1, 3}a/x is treated as

[issue15074] Strange behaviour of python cmd module. (Ignores slash)

2012-06-15 Thread jsevilleja
: jsevilleja priority: normal severity: normal status: open title: Strange behaviour of python cmd module. (Ignores slash) type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file26012/shell.py ___ Python tracker rep...@bugs.python.org http

[issue15074] Strange behaviour of python cmd module. (Ignores slash)

2012-06-15 Thread Peter Otten
Peter Otten __pete...@web.de added the comment: Not a python bug. You are ommitting an important detail of the stackoverflow example in your code: # we want to treat '/' as part of a word, so override the delimiters readline.set_completer_delims(' \t\n;') Please turn to the Python mailing

[issue15074] Strange behaviour of python cmd module. (Ignores slash)

2012-06-15 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15074 ___ ___

[issue12699] strange behaviour of locale.getlocale() - None, None

2011-08-09 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: It should be related to #6203. -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12699 ___

[issue12699] strange behaviour of locale.getlocale() - None, None

2011-08-05 Thread Feth AREZKI
', 'UTF-8') We feel this is strange! -- messages: 141683 nosy: alexis, feth priority: normal severity: normal status: open title: strange behaviour of locale.getlocale() - None, None versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http

[issue12699] strange behaviour of locale.getlocale() - None, None

2011-08-05 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - 3.x locale does not default to C, contrary to the documentation and to 2.x behavior ___ Python tracker

Re: Odp: Re: Strange behaviour of input() function (Python 3.2)

2011-05-25 Thread Algis Kabaila
On Wednesday 25 May 2011 06:27:52 sunrrrise wrote: Ok, another time I'd like to thank you for your help. I gave up, I'm going to get used to IDLE GUI... at least this one works! With IDLE, after any changes to the program, you are asked to save file. IDLE knows that a file in python needs to

Odp: Re: Strange behaviour of input() function (Python 3.2)

2011-05-24 Thread sunrrrise
Ok, another time I'd like to thank you for your help. I gave up, I'm going to get used to IDLE GUI... at least this one works! -- http://mail.python.org/mailman/listinfo/python-list

Odp: Re: Re: Strange behaviour of input() function (Python 3.2)

2011-05-23 Thread sunrrrise
Hello, I have checked another computer (WinXP, 32b) with Komodo Edit 6.1 and ActiveState Python 3.2 - problem still occurs. Have you received my email? s. -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange behaviour of input() function (Python 3.2)

2011-05-23 Thread Chris Angelico
On Tue, May 24, 2011 at 1:44 AM, Aleksander Pietkiewicz sunrrr...@gmail.com wrote: Hello, I have googled your email address, I hope it is not a problem. Thank you for your help! I figured you would get it from my post, but either way works! My email address is fairly well known. Sorry for the

Strange behaviour of input() function (Python 3.2)

2011-05-22 Thread sunrrrise
Hello, this is my first post. I'm trying to learn Python language which I find great, but I have a big problem with its editors/IDEs. I have tested IDLE (which installed with Python3 from ActiveState), Notepad++ and finally Komodo EDIT. I don't like IDLE GUI, but Notepad++ and Komodo EDIT

Re: Strange behaviour of input() function (Python 3.2)

2011-05-22 Thread Chris Angelico
On Mon, May 23, 2011 at 8:43 AM, sunrrrise sunrrr...@gmail.com wrote: Hello, this is my first post. I'm trying to learn Python language which I find great, but I have a big problem with its editors/IDEs. Welcome! b to:  Wprowadz zmienna b: 2 This looks wrong. Are you copying and pasting

Odp: Re: Strange behaviour of input() function (Python 3.2)

2011-05-22 Thread sunrrrise
Thank you for quick response! English is not my native language so I'm going to keep my explanations simple. This really simple script asks me for two variables called a and b. For example, I type 4 for a and 3 for b and IDLE gives me that: Wprowadz zmienna a: 4 Wprowadz zmienna b: 3 a to: 4

Re: Re: Strange behaviour of input() function (Python 3.2)

2011-05-22 Thread Chris Angelico
On Mon, May 23, 2011 at 8:59 AM, sunrrrise sunrrr...@gmail.com wrote: Thank you for quick response! English is not my native language so I'm going to keep my explanations simple. No problem, your English is far better than my Polish. (I used Google Translate to figure out what Wprowadz zmienna

strange behaviour with while-else statement

2011-03-07 Thread Victor Paraschiv
Hi and please help me understand if it is a bug, or..,as someone said, there's a 'bug' in my understanding: (Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32) (windows vista, the regular windows python installer) It's about the following code: while True: s

Re: strange behaviour with while-else statement

2011-03-07 Thread Terry Reedy
On 3/7/2011 11:43 AM, Victor Paraschiv wrote: Hi and please help me understand if it is a bug, or..,as someone said, there's a 'bug' in my understanding: (Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32) (windows vista, the regular windows python installer)

[issue11204] re module: strange behaviour of space inside {m, n}

2011-02-18 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- nosy: +ezio.melotti, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11204 ___ ___

[issue11204] re module: strange behaviour of space inside {m, n}

2011-02-12 Thread John Machin
(re.match(pat2, b{1, 3})) # True and this is not prevented by the suggested changes. -- messages: 128472 nosy: sjmachin priority: normal severity: normal status: open title: re module: strange behaviour of space inside {m, n} versions: Python 2.7, Python 3.1

Dictionary of lists strange behaviour

2010-11-09 Thread Ciccio
Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) In [215]: rg Out[215]: {'a': [], 'b': []} In [216]: rg['a'].append('x') In [217]: rg Out[217]: {'a': ['x'], 'b': ['x']} What I meant

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Matteo Landi
On Tue, Nov 9, 2010 at 3:14 PM, Ciccio franap...@gmail.com wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) The argument you pass which is used to fill the values of the

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Jean-Michel Pichavant
Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) In [215]: rg Out[215]: {'a': [], 'b': []} In [216]: rg['a'].append('x') In [217]: rg Out[217]: {'a': ['x'], 'b':

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Dave Angel
On 2:59 PM, Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) In [215]: rg Out[215]: {'a': [], 'b': []} In [216]: rg['a'].append('x') In [217]: rg Out[217]: {'a':

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Terry Reedy
On 11/9/2010 9:14 AM, Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) If you rewrite this as bl = [] rg = dict.fromkeys(g.keys(),bl) is the answer any more

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Ciccio
Il 09/11/2010 16:47, Terry Reedy ha scritto: On 11/9/2010 9:14 AM, Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) If you rewrite this as bl = [] rg =

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Ciccio
Thank you all, this was timely and helpful. francesco -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Terry Reedy
On 11/9/2010 12:19 PM, Ciccio wrote: Il 09/11/2010 16:47, Terry Reedy ha scritto: On 11/9/2010 9:14 AM, Ciccio wrote: Hi all, hope you can help me understanding why the following happens: In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']} In [214]: rg = dict.fromkeys(g.keys(),[]) If you

Re: Dictionary of lists strange behaviour

2010-11-09 Thread John Posner
On 11/9/2010 1:43 PM, Terry Reedy wrote: ... List *is* useful as an initializer for collecitons.defaultdicts. And it was useful when several members of this forum helped me to develop a prime-number generator. See http://www.mail-archive.com/python-list@python.org/msg288128.html. (I meant

Re: List comprehension + lambdas - strange behaviour

2010-05-07 Thread Neil Cerutti
On 2010-05-07, Terry Reedy tjre...@udel.edu wrote: On 5/6/2010 3:34 PM, Artur Siekielski wrote: Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] [f() for f in funs] [4, 4, 4, 4, 4] You succumbed to lambda hypnosis

Re: List comprehension + lambdas - strange behaviour

2010-05-07 Thread Terry Reedy
On 5/7/2010 8:31 AM, Neil Cerutti wrote: On 2010-05-07, Terry Reedytjre...@udel.edu wrote: On 5/6/2010 3:34 PM, Artur Siekielski wrote: Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] [f() for f in funs] [4, 4, 4, 4

List comprehension + lambdas - strange behaviour

2010-05-06 Thread Artur Siekielski
Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] [f() for f in funs] [4, 4, 4, 4, 4] Of course I was expecting the list [0, 1, 2, 3, 4] as the result. The 'x' was bound to the final value of 'range(5)' expression for ALL

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Emile van Sebille
On 5/6/2010 12:34 PM Artur Siekielski said... Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] funs is now a list of lambda functions that return 'x' (whatever it currently is from whereever it's accessible when invoked

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Benjamin Peterson
Artur Siekielski artur.siekielski at gmail.com writes: Of course I was expecting the list [0, 1, 2, 3, 4] as the result. The 'x' was bound to the final value of 'range(5)' expression for ALL defined functions. Can you explain this? Is this only counterintuitive example or an error in

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Raymond Hettinger
On May 6, 9:34 pm, Artur Siekielski artur.siekiel...@gmail.com wrote: Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] [f() for f in funs] [4, 4, 4, 4, 4] Of course I was expecting the list [0, 1, 2, 3, 4

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Terry Reedy
On 5/6/2010 3:34 PM, Artur Siekielski wrote: Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] [f() for f in funs] [4, 4, 4, 4, 4] You succumbed to lambda hypnosis, a common malady ;-). The above will not work in 3.x

[issue7630] Strange behaviour of decimal.Decimal

2010-01-04 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: You don't say what behaviour you were expecting! :) By design, almost all Decimal operations (but not creation of a Decimal from an integer or string) round to the precision given by the current context. By default that precision is 28

[issue7630] Strange behaviour of decimal.Decimal

2010-01-04 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: It might also help to note that, with decimal, what you see (from repr() of a Decimal instance) is *exactly* what you get. So when you see dec Decimal('1.797693134862315907729305191E+308') that number really is exactly what's stored in

[issue7630] Strange behaviour of decimal.Decimal

2010-01-03 Thread parmax
('2.109752663820230210576934273E+280') dec == Decimal('0.1') False -- components: Library (Lib) messages: 97192 nosy: parmax severity: normal status: open title: Strange behaviour of decimal.Decimal type: behavior versions: Python 2.6 ___ Python tracker rep

strange behaviour of colon within string

2009-10-19 Thread khany
hello all, i am relatively new to python and i am trying to convert a php app i have over to it using googleapps. anyway here is the problem. i poll ebay API which has in its XML ? xml version=1.0 encoding=utf-8?findItemsAdvancedRequest xmlns=http://www.ebay.com/marketplace/search/v1/services;

Re: strange behaviour of colon within string

2009-10-19 Thread Diez B. Roggisch
khany wrote: hello all, i am relatively new to python and i am trying to convert a php app i have over to it using googleapps. anyway here is the problem. i poll ebay API which has in its XML ? xml version=1.0 encoding=utf-8?findItemsAdvancedRequest

Re: strange behaviour of colon within string

2009-10-19 Thread Wolodja Wentland
On Mon, Oct 19, 2009 at 05:44 -0700, khany wrote: i am relatively new to python and i am trying to convert a php app i have over to it using googleapps. Welcome! anyway here is the problem. i poll ebay API which has in its XML ? xml version=1.0 encoding=utf-8?findItemsAdvancedRequest

Re: strange behaviour of colon within string

2009-10-19 Thread khany
On 19 Oct, 13:44, khany sharif.k...@gmail.com wrote: hello all, i am relatively new to python and i am trying to convert a php app i have over to it using googleapps. anyway here is the problem. i poll ebay API which has in its XML ? xml version=1.0 encoding=utf-8?findItemsAdvancedRequest

Re: strange behaviour of colon within string

2009-10-19 Thread StarWing
On Oct 19, 9:15 pm, khany sharif.k...@gmail.com wrote: On 19 Oct, 13:44, khany sharif.k...@gmail.com wrote: hello all, i am relatively new to python and i am trying to convert a php app i have over to it using googleapps. anyway here is the problem. i poll ebay API which has in its XML

Re: strange behaviour of colon within string

2009-10-19 Thread khany
On 19 Oct, 14:44, StarWing weasley...@sina.com wrote: On Oct 19, 9:15 pm, khany sharif.k...@gmail.com wrote: On 19 Oct, 13:44, khany sharif.k...@gmail.com wrote: hello all, i am relatively new to python and i am trying to convert a php app i have over to it using googleapps.

Re: strange behaviour when inheriting from tuple

2009-10-12 Thread ryles
On Oct 11, 3:04 am, metal metal...@gmail.com wrote: Environment: PythonWin 2.5.4 (r254:67916, Apr 27 2009, 15:41:14) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information. Evil Code: class Foo:      

Re: strange behaviour when inheriting from tuple

2009-10-11 Thread metal
On 10月11日, 下午5时30分, ryles ryle...@gmail.com wrote: On Oct 11, 3:04 am, metal metal...@gmail.com wrote: Environment: PythonWin 2.5.4 (r254:67916, Apr 27 2009, 15:41:14) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for

Re: raw_input(), STRANGE behaviour

2008-01-28 Thread Dox33
YES! This is what I was looking for. Great! All works fine now. Thank you very much Gabriel. Gabriel Genellina schreef: Add this on your sitecustomize.py module (or create one) import sys def raw_input(prompt=None): if prompt: sys.stdout.write(prompt) return original_raw_input()

Re: raw_input(), STRANGE behaviour

2008-01-27 Thread Dox33
Yes, I know. There are several ways to work around the problem. (Look at the innitial code I provided in this discussion start) Fact is, every time I'm getting a script from somewhere or someone, I have to search and replace all the affected code. Not very conveniant. That's why I rather would

Re: raw_input(), STRANGE behaviour

2008-01-27 Thread Gabriel Genellina
En Sun, 27 Jan 2008 12:51:51 -0200, Dox33 [EMAIL PROTECTED] escribi�: Yes, I know. There are several ways to work around the problem. (Look at the innitial code I provided in this discussion start) Fact is, every time I'm getting a script from somewhere or someone, I have to search and

Re: raw_input(), STRANGE behaviour

2008-01-27 Thread sevenbark
On Sat, 26 Jan 2008 04:23:36 -0800 (PST), Dox33 [EMAIL PROTECTED] wrote: snip WHERE IS THE SECOND LINE? It is in the file stderr_catch.txt!!! See the problem? Please Tell me? Why is the prompt produced by raw_input() printed to the error channel? It should be stdout, just as the print

raw_input(), STRANGE behaviour

2008-01-26 Thread Dox33
I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. (Or is this a problem in the python source?) I will explain the problem by using 3 examples. (Sorry, long email) The first two examples are behaving normal, the thirth is strange... I wrote

Re: raw_input(), STRANGE behaviour

2008-01-26 Thread Mike Kent
On Jan 26, 7:23 am, Dox33 [EMAIL PROTECTED] wrote: I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. ===CUT=== *** Thirst, redirect stderr to file, STRANGE behaviour.. From the command prompt I run: python script.py 2 stderr_catch.txt

Re: raw_input(), STRANGE behaviour

2008-01-26 Thread Dox33
] wrote: On Jan 26, 7:23 am, Dox33 [EMAIL PROTECTED] wrote: I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. ===CUT=== *** Thirst, redirect stderr to file, STRANGE behaviour.. From the command prompt I run: python script.py 2

Re: raw_input(), STRANGE behaviour

2008-01-26 Thread Terry Reedy
I believe a workaround to the bug of raw_input sending the prompt to stderr is print 'prompt:', a = raw_input() Not nice, but possibly better that waiting for a corrected binary. -- http://mail.python.org/mailman/listinfo/python-list

Re: raw_input(), STRANGE behaviour

2008-01-26 Thread Hrvoje Niksic
Dox33 [EMAIL PROTECTED] writes: Thanks for your reply. Since I momentarily do not have the ability to build a new python executable, I would like to ask for your help in this case. Are you able to supply me with a corrected version? You can simply choose not to use raw_input, and use

Re: Class destructor -- strange behaviour

2007-12-07 Thread Jason
On Dec 6, 2:51 pm, Spes [EMAIL PROTECTED] wrote: Hi, I have this simple code: | #!/usr/bin/python | import codecs | import re | from copy import deepcopy | | class MyClass(object): | def __del__(self): | deepcopy(1) | | x=MyClass() but I get an error: | Exception

Class destructor -- strange behaviour

2007-12-06 Thread Spes
Hi, I have this simple code: | #!/usr/bin/python | import codecs | import re | from copy import deepcopy | | class MyClass(object): | def __del__(self): | deepcopy(1) | | x=MyClass() but I get an error: | Exception exceptions.TypeError: 'NoneType' object is not callable in bound method

Re: Class destructor -- strange behaviour

2007-12-06 Thread MonkeeSage
On Dec 6, 3:51 pm, Spes [EMAIL PROTECTED] wrote: Hi, I have this simple code: | #!/usr/bin/python | import codecs | import re | from copy import deepcopy | | class MyClass(object): | def __del__(self): | deepcopy(1) | | x=MyClass() but I get an error: | Exception

Re: Class destructor -- strange behaviour

2007-12-06 Thread Gabriel Genellina
En Thu, 06 Dec 2007 18:51:08 -0300, Spes [EMAIL PROTECTED] escribió: I have this simple code: | #!/usr/bin/python | import codecs | import re | from copy import deepcopy | | class MyClass(object): | def __del__(self): | deepcopy(1) | | x=MyClass() but I get an error: |

Re: Strange behaviour with reversed()

2007-10-19 Thread Duncan Booth
Andreas Kraemer [EMAIL PROTECTED] wrote: The only other behaviours I would regard as intuitive for iteration over a mutating sequence would be to throw an exception either for mutating the sequence while the iterator exists or for using the iterator after a mutation. Maybe it would have

Re: Strange behaviour with reversed()

2007-10-19 Thread Andreas Kraemer
On Oct 19, 1:49 pm, Duncan Booth [EMAIL PROTECTED] wrote: Andreas Kraemer [EMAIL PROTECTED] wrote: The only other behaviours I would regard as intuitive for iteration over a mutating sequence would be to throw an exception either for mutating the sequence while the iterator exists or for

Re: Strange behaviour with reversed()

2007-10-18 Thread Steven D'Aprano
On Thu, 18 Oct 2007 02:49:12 -0300, Gabriel Genellina wrote: A reversed object is rather simple: it stores the original sequence (a reference, as usual, not a copy!) and the next index to use, starting at len-1. Each time the next() method is called, the index is decremented until it goes

Re: Strange behaviour with reversed()

2007-10-18 Thread Steven D'Aprano
On Thu, 18 Oct 2007 15:24:27 +1000, Ben Finney wrote: Steven D'Aprano [EMAIL PROTECTED] writes: and help(reversed) but neither gives any insight to what happens when you use reversed() on a sequence, then modify the sequence. I would think the answer is the same for any question about

<    1   2   3   4   >