Re: dynamic values in yaml

2014-08-19 Thread raphinou
On Tuesday, August 19, 2014 7:15:54 PM UTC+2, Rustom Mody wrote: > On Tuesday, August 19, 2014 10:31:03 PM UTC+5:30, Laurent Pointal wrote: > > > raphinou wrote: > > > > > > Hi, > > > > I'm using pyyaml, and need some values in a yaml files to be dynamic, > > > for > > > > example somethin

Re: How can I get the timezone time of a location?

2014-08-19 Thread Ben Finney
luofeiyu writes: > would you mind sending the video to my mailbox? Please, remember to post interleaved style. Don't top-post. > There is no video in the web when i open it in my firefox. The page describing the video also has a link to the hosted site of the video, see the “Video origin” fiel

Re: How can I get the timezone time of a location?

2014-08-19 Thread luofeiyu
would you mind sending the video to my mailbox? There is no video in the web when i open it in my firefox. think you in advance. Even with perfect knowledge, you can't always do that. There are points on the globe which use two timezones. :) http://pyvideo.org/video/1765/blame-it-on-caesar-

Re: 'is not' or '!='

2014-08-19 Thread Rustom Mody
On Wednesday, August 20, 2014 10:29:13 AM UTC+5:30, Steven D'Aprano wrote: > On Tue, 19 Aug 2014 21:01:49 -0700, Rustom Mody wrote: > > I also (once!) had a student who started every single > > variable/function/filename with his name!! > I recall somebody on the Python tutor mailing list doing t

Re: why i can't get the sourcecode with inspect module?

2014-08-19 Thread Steven D'Aprano
On Wed, 20 Aug 2014 11:05:26 +0800, luofeiyu wrote: import inspect > >>> def changer(x,y): > ... return(x+y) The interactive interpreter doesn't store the source code you type. It compiles it to byte-code, executes the byte-code, and throws the source code away. -- Steven -- http

Re: 'is not' or '!='

2014-08-19 Thread Steven D'Aprano
On Tue, 19 Aug 2014 21:01:49 -0700, Rustom Mody wrote: > I also (once!) had a student who started every single > variable/function/filename with his name!! I recall somebody on the Python tutor mailing list doing that. They did so because their course instructor made it a requirement and failed

Re: asyncio subprocess PIPE output lost

2014-08-19 Thread yuzhichang
On Wednesday, August 20, 2014 1:08:17 AM UTC+8, Kushal Kumaran wrote: > On Tue, Aug 19, 2014 at 1:09 PM, yuzhichang wrote: > > > Hi all, > > > I'm new to asyncio introduced by Python 3.4. I created two tasks each > > pings a host. I noticed some pieces of output will be lost(see "error: >

Re: 'is not' or '!='

2014-08-19 Thread Rustom Mody
On Wednesday, August 20, 2014 4:54:00 AM UTC+5:30, Ben Finney wrote: > Tim Chase writes: > > Am I the only one who feels the urge to write > > if i am some_other_object: ... > > if we are some_other_object: ... > > if u are some_other_object: ... # though txtspk bothers me > How often do yo

Re: why i can't get the sourcecode with inspect module?

2014-08-19 Thread Ben Finney
luofeiyu writes: > >>> import inspect > >>> def changer(x,y): > ... return(x+y) > ... At this point, you have defined a function. It is accessible via the ‘changer’ name, and the code is available. But the source code is not available; Python reads standard input but doesn't preserve it. >

why i can't get the sourcecode with inspect module?

2014-08-19 Thread luofeiyu
>>> import inspect >>> def changer(x,y): ... return(x+y) ... >>> dir() ['__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__ 'changer', 'inspect'] >>> inspect.getsource(changer) Traceback (most recent call last): File "", line 1, in File "D:\Python34\lib\inspect.py", l

Re: How to look up historical time zones by date and location

2014-08-19 Thread Ben Finney
luofeiyu writes: > >>> tz1 > > >>> repr(tz1) > "" Yes. Remember that ‘repr’ is for the benefit of the programmer, and there is no promise of what it contains. > >>> x=repr(tz1) > >>> x > "" > >>> import re > >>> re.search("LMT.+\s",x).group() > 'LMT+8:06:00 ' This is wildly fragile. The ‘repr

Re: How to look up historical time zones by date and location

2014-08-19 Thread luofeiyu
>>> tz1 >>> repr(tz1) "" >>> x=repr(tz1) >>> x "" >>> import re >>> re.search("LMT.+\s",x).group() 'LMT+8:06:00 ' i got it ,thinks to all my friends . -- https://mail.python.org/mailman/listinfo/python-list

Re: efficient partial sort in Python ?

2014-08-19 Thread Ian Kelly
On Tue, Aug 19, 2014 at 5:05 PM, Dan Stromberg wrote: > When you use heapq, are you putting all the values in the heap, or > just up to n at a time (evicting the worst value, one at a time as you > go)? If you're doing the former, it's basically a heapsort which > probably won't beat timsort. If

Re: Easiest Way to Do Cross-Platform DB Access (Oracle)

2014-08-19 Thread TommyVee
"Gary Furash" wrote in message news:135759bf-0823-480c-9631-106d6cf1a...@googlegroups.com... I need to be able to access Oracle from both Windows and *nix, however, it seems kind of tortuous getting everything working each time on each server. With Java I can just drop (usually the same) JDBC

Re: More Pythonic implementation

2014-08-19 Thread Ben Finney
Shubham Tomar writes: > Lets say I have a function poker(hands) that takes a list of hands and > returns the highest ranking hand, and another function hand_rank(hand) > that takes hand and return its rank. To make it clearer, I think you mean something like this:: def hand_rank(hand):

Re: How can I get the timezone time of a location?

2014-08-19 Thread Chris Angelico
On Wed, Aug 20, 2014 at 9:08 AM, Cameron Simpson wrote: > there is no way to go from a physcial point of the surface of the Earth to > the timezone mapping name that should be used. (Using only the Olsen > timezone db.) Even with perfect knowledge, you can't always do that. There are points on th

Re: 'is not' or '!='

2014-08-19 Thread Ben Finney
Tim Chase writes: > Am I the only one who feels the urge to write > > if i am some_other_object: ... > if we are some_other_object: ... > if u are some_other_object: ... # though txtspk bothers me How often do you need to refer to an object with personal pronouns? I think for me the answer

Re: efficient partial sort in Python ?

2014-08-19 Thread Dan Stromberg
On Tue, Aug 19, 2014 at 4:10 PM, Dan Stromberg wrote: > On Tue, Aug 19, 2014 at 4:05 PM, Dan Stromberg wrote: >> When you use heapq, are you putting all the values in the heap, or >> just up to n at a time (evicting the worst value, one at a time as you >> go)? If you're doing the former, it's b

Re: How to look up historical time zones by date and location

2014-08-19 Thread Cameron Simpson
On 19Aug2014 09:31, luofeiyu wrote: My dear friends here, all i want is get ` LMT+8:06:00` from the output of tz1 `` Shall we get back to the main point? That didn't seem to be your main point. You seemed to want to get Asia/Urumqi time by either natural longituide or by Beijing Time,

Re: efficient partial sort in Python ?

2014-08-19 Thread Dan Stromberg
On Tue, Aug 19, 2014 at 4:05 PM, Dan Stromberg wrote: > When you use heapq, are you putting all the values in the heap, or > just up to n at a time (evicting the worst value, one at a time as you > go)? If you're doing the former, it's basically a heapsort which > probably won't beat timsort. If

Re: How can I get the timezone time of a location?

2014-08-19 Thread Cameron Simpson
On 18 August 2014 04:28 "luofeiyu" The land area of China is 60-degree longitude from west to east. According to the demarcation of the world time zoning standard, the land area of China lies between the eastern fifth to ninth time zones, there are 5 time zones in china in fact. Currently, al

Re: efficient partial sort in Python ?

2014-08-19 Thread Dan Stromberg
On Tue, Aug 19, 2014 at 12:37 PM, Chiu Hsiang Hsu wrote: > On Tuesday, August 19, 2014 5:42:27 AM UTC+8, Dan Stromberg wrote: >> On Mon, Aug 18, 2014 at 10:18 AM, Chiu Hsiang Hsu wrote: >> >> > I know that Python use Timsort as default sorting algorithm and it is >> > efficient, >> >> > but I ju

Re: 'is not' or '!='

2014-08-19 Thread Marko Rauhamaa
Ian Kelly : > On Tue, Aug 19, 2014 at 3:00 PM, Marko Rauhamaa wrote: >> For a more worthy attempt, we'll have to take a look at Scheme (> http://www.scheme.com/tspl2d/objects.html>): > > Those are invariants, not a definition. The actual definition is > found in the paragraph above: > > "In most

Re: Python in financial services

2014-08-19 Thread Mark Lawrence
On 19/08/2014 22:59, Terry Reedy wrote: On 8/19/2014 12:35 PM, Laurent Pointal wrote: wxjmfa...@gmail.com wrote: Py3: It may luckily work, Python may crash or fails (it raises unicode errors on valid string!). Py2: It is safer and solid. The truth is that 2.7 has many unicode bugs that hav

Re: PyQt4 - Issue with deleting a QWidget from a QGridLayout

2014-08-19 Thread Vincent Vande Vyvre
Le 20/08/2014 00:11, Alex Murray a écrit : Hi, I've discovered some very strange behaviour when trying to delete a QWidget from a QGridLayout. The following code demonstrates this behaviour: >>> from PyQt4 import QtGui >>> import sys >>> app = QtGui.QApplication(sys.argv) >>> grid_layout = QtG

Re: Python 2.7 IDLE Win32 interactive, pasted characters i- wrong encoding

2014-08-19 Thread Chris Angelico
On Wed, Aug 20, 2014 at 7:44 AM, Terry Reedy wrote: > Whoops, I pasted the wrong (which is to say, correct) output. > The right (worse incorrect) interactive output is > > U+20AC is is 0x80 in CP-1252 > The console interpreter gives me > u"U+20AC is ? is 0x80 in CP-1252" Ah! You had me highly con

Easiest Way to Do Cross-Platform DB Access (Oracle)

2014-08-19 Thread Gary Furash
I need to be able to access Oracle from both Windows and *nix, however, it seems kind of tortuous getting everything working each time on each server. With Java I can just drop (usually the same) JDBC library files in a location and everything works. I'm sure there's some easier way of doing thi

Re: 'is not' or '!='

2014-08-19 Thread Terry Reedy
On 8/19/2014 3:05 PM, Mark Lawrence wrote: On 19/08/2014 19:26, Steven D'Aprano wrote: Marko Rauhamaa wrote: CPython implementation detail: This is the address of the object in memory. I really wish CPython didn't do that, or at least not admit to it. It does nothing but conf

Re: 'is not' or '!='

2014-08-19 Thread Ian Kelly
On Tue, Aug 19, 2014 at 3:00 PM, Marko Rauhamaa wrote: > For a more worthy attempt, we'll have to take a look at Scheme ( http://www.scheme.com/tspl2d/objects.html>): Those are invariants, not a definition. The actual definition is found in the paragraph above: "In most Scheme systems, two obje

PyQt4 - Issue with deleting a QWidget from a QGridLayout

2014-08-19 Thread Alex Murray
Hi,   I've discovered some very strange behaviour when trying to delete a QWidget from a QGridLayout. The following code demonstrates this behaviour:   >>> from PyQt4 import QtGui >>> import sys >>> app = QtGui.QApplication(sys.argv) >>> grid_layout = QtGui.QGridLayout() >>> grid_layout.addW

Re: efficient partial sort in Python ?

2014-08-19 Thread Terry Reedy
On 8/19/2014 3:37 PM, Chiu Hsiang Hsu wrote: On Tuesday, August 19, 2014 5:42:27 AM UTC+8, Dan Stromberg wrote: On Mon, Aug 18, 2014 at 10:18 AM, Chiu Hsiang Hsu wrote: I know that Python use Timsort as default sorting algorithm and it is efficient, Especially with data that is partially or

Re: Python in financial services

2014-08-19 Thread Terry Reedy
On 8/19/2014 12:35 PM, Laurent Pointal wrote: wxjmfa...@gmail.com wrote: Py3: It may luckily work, Python may crash or fails (it raises unicode errors on valid string!). Py2: It is safer and solid. The truth is that 2.7 has many unicode bugs that have been fixed in in various 3.x releases.

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-19 Thread Terry Reedy
On 8/19/2014 4:05 AM, Furqan wasi wrote: Please post plain text instead of html. path and name , i need some help to in how to make library libsndfile/Sndfile to read file with special character in it i.e C:\Users\Furqan\Desktop\test\查找問題daw\查找問題d.wav, as i mentioned in my first email Use 3.

Re: Python 2.7 IDLE Win32 interactive, pasted characters i- wrong encoding

2014-08-19 Thread Terry Reedy
On 8/19/2014 5:23 AM, Chris Angelico wrote: On Tue, Aug 19, 2014 at 7:03 PM, Terry Reedy wrote: On 8/18/2014 7:44 PM, Chris Angelico wrote: u"U+20AC is € is 0x80 in CP-1252" u'U+20AC is \x80 is 0x80 in CP-1252' Better than what I get on my 3.4.1 Win7 U+20AC is € is 0x80 in CP-1252 How

Re: Matplotlib Contour Plots

2014-08-19 Thread pecore
Jamie Mitchell writes: > You were right Christian I wanted a shape (2,150). > > Thank you Rustom and Steven your suggestion has worked. > > Unfortunately the data doesn't plot as I imagined. > > What I would like is: > > X-axis - hs_con_sw > Y-axis - te_con_sw > Z-axis - Frequency > > What I woul

Re: 'is not' or '!='

2014-08-19 Thread Marko Rauhamaa
Marko Rauhamaa : > That's circular reasoning. When you are defining Python's execution > model, you can't refer back to Python's execution model. > > For a good example of what I'm after, take a look how Java specifies its > crucial happens-before relation: > >http://docs.oracle.com/javase

Re: efficient partial sort in Python ?

2014-08-19 Thread Chiu Hsiang Hsu
On Tuesday, August 19, 2014 5:42:27 AM UTC+8, Dan Stromberg wrote: > On Mon, Aug 18, 2014 at 10:18 AM, Chiu Hsiang Hsu wrote: > > > I know that Python use Timsort as default sorting algorithm and it is > > efficient, > > > but I just wanna have a partial sorting (n-largest/smallest elements). >

Re: Collaps arrays/ list of intergers

2014-08-19 Thread Denis McMahon
On Tue, 19 Aug 2014 05:54:24 -0700, Jurgens de Bruin wrote: > I do hope somebody can help me with the following: > I have the followings lists which represent the upper and lower value of > a range/array. > > a = [1,50] > b = [75,150] > c = [25,42] > d = [120,149] > e = [35,55] I think you're st

Re: 'is not' or '!='

2014-08-19 Thread Mark Lawrence
On 19/08/2014 19:26, Steven D'Aprano wrote: Marko Rauhamaa wrote: CPython implementation detail: This is the address of the object in memory. I really wish CPython didn't do that, or at least not admit to it. It does nothing but confuse people. I agree and would happily sup

Re: More Pythonic implementation

2014-08-19 Thread Chris Kaynor
On Tue, Aug 19, 2014 at 10:09 AM, Shubham Tomar wrote: > Lets say I have a function poker(hands) that takes a list of hands and > returns the highest ranking hand, and another function hand_rank(hand) that > takes hand and return its rank. As in Poker > http://www.pokerstars.com/poker/games/rules

Re: 'is not' or '!='

2014-08-19 Thread Marko Rauhamaa
Steven D'Aprano : > Python identity is represented by an integer, and it is guaranteed to > be unique and constant for the lifetime of the object. It may or may > not be reused once the object no longer exists. That's all you need to > know about identity; that's *all there is to know* about ident

Re: 'is not' or '!='

2014-08-19 Thread Skip Montanaro
On Tue, Aug 19, 2014 at 11:42 AM, Ian Kelly wrote: > When I need to do this, I use: > > SENTINEL = object() > > It's still a singleton, and why should a sentinel be mutable? Old habits die hard, I guess. I've been using Python since long before object() existed. :-) Skip -- https://mail.pyt

Re: asyncio subprocess PIPE output lost

2014-08-19 Thread Kushal Kumaran
On Tue, Aug 19, 2014 at 1:09 PM, yuzhichang wrote: > Hi all, > I'm new to asyncio introduced by Python 3.4. I created two tasks each > pings a host. I noticed some pieces of output will be lost(see "error: found > icmp_seq gap"). If I changed to run only one task, this problem never occur. >

Re: Collaps arrays/ list of intergers

2014-08-19 Thread Rock Neurotiko
Hi, I made a fast implementation (I'm sure that can be done better) but it works (for what I understood). Is tested in Python3.4, if you will execute in Python 2.x, or don't have mypy or don't like it, you always can remove the function annotations :) http://gist.github.com/rockneurotiko/017044d

Re: 'is not' or '!='

2014-08-19 Thread Steven D'Aprano
Marko Rauhamaa wrote: > Skip Montanaro : > >> The use of "is" or "is not" is the right thing to do when the object >> of the comparison is known to be a singleton. > > Object identity stirs a lot of passions on this forum. I'm guessing the > reason is that it is not defined very clearly ( https:

Re: 'is not' or '!='

2014-08-19 Thread Marko Rauhamaa
Tim Chase : > Note that a lifetime can be less than a statement: > id([1,2,3]) == id([4,5,6]) > True Duly noted. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Functions on list items

2014-08-19 Thread Kurt
> > Maybe http://pandas.pydata.org/ ??? > > Thanks. This reply is like that butterfly wing flap causing hurricanes a world away; big steerage away from proprietary stuff used in my org. Detox will take some time though. K -- https://mail.python.org/mailman/listinfo/python-list

Re: Functions on list items

2014-08-19 Thread Tim Chase
On 2014-08-19 10:34, Kurt wrote: > I am trying to process the following calendar and data attributes > in a file: Da Mo Yr AttrA AttrB AttrC... > I need to average AttrA for each of 365 Da days across Yr years. > Then do the same for 27K files. Repeat for AttrB, AttrC etc. Can I > do the averaging

Re: Collaps arrays/ list of intergers

2014-08-19 Thread Peter Otten
Jurgens de Bruin wrote: > Hi All, > > I do hope somebody can help me with the following: > I have the followings lists which represent the upper and lower value of a > range/array. > > a = [1,50] > b = [75,150] > c = [25,42] > d = [120,149] > e = [35,55] > > What I would like to happen is that

Re: Why Python 4.0 won't be like Python 3.0

2014-08-19 Thread Steven D'Aprano
Grant Edwards wrote: > I do > remember delaying moving from 1.5.2 -> 2.0 until I really had to, but > I don't remember why. I remember delaying moving from 1.5 until 2.3, but I remember why. Three reasons: (1) People are often like cats, and like cats, they are either curious and inquisitive abo

Re: Begginer in python trying to load a .dll

2014-08-19 Thread ElChino
"Laurent Pointal" wrote: On Windows there is dumpbin http://msdn.microsoft.com/en-us/library/c1h23y6c%28v=vs.100%29.aspx On Windows, google also found this graphical tool: http://www.dependencywalker.com/ PEdump is also a great tool: http://www.wheaty.net/pedump.zip Includes source too. -

Re: How to look up historical time zones by date and location

2014-08-19 Thread Denis McMahon
On Tue, 19 Aug 2014 10:25:58 -0600, Ian Kelly wrote: > We might be able to be more helpful if you would be more clear about > what problem it is that you are trying to solve. Are you trying, for a > given point on the Earth, to determine what nautical time zone it falls > into, or some other "natu

Re: Functions on list items

2014-08-19 Thread Mark Lawrence
On 19/08/2014 18:34, Kurt wrote: I am trying to process the following calendar and data attributes in a file: Da Mo Yr AttrA AttrB AttrC... I need to average AttrA for each of 365 Da days across Yr years. Then do the same for 27K files. Repeat for AttrB, AttrC etc. Can I do the averaging with li

Re: 'is not' or '!='

2014-08-19 Thread Marko Rauhamaa
Ian Kelly : > When I need to do this, I use: > > SENTINEL = object() > > It's still a singleton, and why should a sentinel be mutable? Private enums are often nicer in that they provide str() and repr(). Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: 'is not' or '!='

2014-08-19 Thread Tim Chase
On 2014-08-19 20:29, Marko Rauhamaa wrote: > The "is" relation can be defined trivially through the id() > function: > >X is Y iff id(X) == id(Y) > > What remains is the characterization of the (total) id() function. > For example, we can stipulate that: > >X = Y >assert(id(X) == id(

Functions on list items

2014-08-19 Thread Kurt
I am trying to process the following calendar and data attributes in a file: Da Mo Yr AttrA AttrB AttrC... I need to average AttrA for each of 365 Da days across Yr years. Then do the same for 27K files. Repeat for AttrB, AttrC etc. Can I do the averaging with lists or do I need some Python Db mod

Re: 'is not' or '!='

2014-08-19 Thread Marko Rauhamaa
Skip Montanaro : > The use of "is" or "is not" is the right thing to do when the object > of the comparison is known to be a singleton. Object identity stirs a lot of passions on this forum. I'm guessing the reason is that it is not defined very clearly (https://docs.python.org/3/library/function

Re: dynamic values in yaml

2014-08-19 Thread Rustom Mody
On Tuesday, August 19, 2014 10:31:03 PM UTC+5:30, Laurent Pointal wrote: > raphinou wrote: > > Hi, > > I'm using pyyaml, and need some values in a yaml files to be dynamic, > for > > example somethin like: > > filename: /tmp/backup_{% time.strftime('%Y-%m-%d') }.tgz > > Is there a simple way t

Re: dynamic values in yaml

2014-08-19 Thread Laurent Pointal
raphi...@gmail.com wrote: > Hi, > > I'm using pyyaml, and need some values in a yaml files to be dynamic, for > example somethin like: > > filename: /tmp/backup_{% time.strftime('%Y-%m-%d') }.tgz > > Is there a simple way to achieve this? (Eg with a templating system that > would first hand

Re: Begginer in python trying to load a .dll

2014-08-19 Thread Laurent Pointal
c1234 py wrote: > This appear in the terminal: > > runfile('C://Python Scripts') > File "C:\\sitecustomize.py", line 585, in runfile > execfile(filename, namespace) > File "C://Sin título 38.py", line 19, in > hllApi = hllApiProto (("HLLAPI", hllDll), hllApiParams) > AttributeE

Re: 'is not' or '!='

2014-08-19 Thread Ian Kelly
On Tue, Aug 19, 2014 at 7:12 AM, Skip Montanaro wrote: > The use of "is" or "is not" is the right thing to do when the object > of the comparison is known to be a singleton. That is true for None. > (I suspect it's true for True and False as well, though for historical > and idiomatic reasons "x i

Re: Python in financial services

2014-08-19 Thread Laurent Pointal
wxjmfa...@gmail.com wrote: > I recommend to toy intensively with the 'EURO SIGN' in > strings manipulations. > > Py3: It may luckily work, Python may crash or fails (it raises > unicode errors on valid string!). > > Py2: It is safer and solid. There is however a subtility. 3rd > party tools may

Re: How to look up historical time zones by date and location

2014-08-19 Thread Ian Kelly
On Mon, Aug 18, 2014 at 7:31 PM, luofeiyu wrote: > My dear friends here, all i want is get ` LMT+8:06:00` from the output > of tz1 `` > > Shall we get back to the main point? > > If you are interested in it ,please say yes or no ,and how to do that ? > > > import pytz,datetime > tz1 = pytz.ti

Re: Collaps arrays/ list of intergers

2014-08-19 Thread Peter Pearson
On Tue, 19 Aug 2014 05:54:24 -0700 (PDT), Jurgens de Bruin wrote: > > I do hope somebody can help me with the following: > I have the followings lists which represent the upper and lower value > of a range/array. > > a = [1,50] > b = [75,150] > c = [25,42] > d = [120,149] > e = [35,55] > > What I w

Re: Why Python 4.0 won't be like Python 3.0

2014-08-19 Thread Johann Hibschman
Skip Montanaro writes: > On Tue, Aug 19, 2014 at 9:27 AM, Grant Edwards > wrote: >> I'm probably conflating the 1.5.2/2.0 and the 2.6 stuff. I do >> remember delaying moving from 1.5.2 -> 2.0 until I really had to, but >> I don't remember why. > > If you were a RedHat user during that timefram

Re: Why Python 4.0 won't be like Python 3.0

2014-08-19 Thread Grant Edwards
On 2014-08-19, Skip Montanaro wrote: > On Tue, Aug 19, 2014 at 9:27 AM, Grant Edwards > wrote: >> I'm probably conflating the 1.5.2/2.0 and the 2.6 stuff. I do >> remember delaying moving from 1.5.2 -> 2.0 until I really had to, but >> I don't remember why. > > If you were a RedHat user during

Re: Why Python 4.0 won't be like Python 3.0

2014-08-19 Thread Skip Montanaro
On Tue, Aug 19, 2014 at 9:27 AM, Grant Edwards wrote: > I'm probably conflating the 1.5.2/2.0 and the 2.6 stuff. I do > remember delaying moving from 1.5.2 -> 2.0 until I really had to, but > I don't remember why. If you were a RedHat user during that timeframe, that might have contributed to yo

dynamic values in yaml

2014-08-19 Thread raphinou
Hi, I'm using pyyaml, and need some values in a yaml files to be dynamic, for example somethin like: filename: /tmp/backup_{% time.strftime('%Y-%m-%d') }.tgz Is there a simple way to achieve this? (Eg with a templating system that would first handle the template parts from the yaml file) Th

Re: Why Python 4.0 won't be like Python 3.0

2014-08-19 Thread Grant Edwards
On 2014-08-19, Steven D'Aprano wrote: > Grant Edwards wrote: > >> On 2014-08-18, Ethan Furman wrote: >>> On 08/18/2014 07:51 AM, Grant Edwards wrote: To all of us out here in user-land a change in the first value in the version tuple means breakage and incompatibilities. And when t

MacroPy tracing not working for me...

2014-08-19 Thread Skip Montanaro
I just downloaded and installed MacroPy (pip install --user MacroPy), with an intention of sticking a "with trace:" inside a failing unit test being run with nosetests. If I understood the example on the PyPI page correctly, I should have been able to do this: import macropy.tracing with macropy.t

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-19 Thread Furqan wasi
*with code * # -*- coding: UTF-8 -*- import numpy, os from scikits.audiolab import Sndfile from os import walk, path, stat file = u"C:/Users/Furqan/Desktop/查找問題Reference/1.wav" track1 = file track_one_file_obj = Sndfile(track1, 'r') Getting this Traceback (most recent call last): File "D:/pyt

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-19 Thread MRAB
On 2014-08-19 13:14, Furqan wasi wrote: Getting this file = ur"C:\Users\Furqan\Desktop\查找問題Reference\1.wav" SyntaxError: (unicode error) 'rawunicodeescape' codec can't decode bytes in position 2-3: truncated \u Ouch! That's Python 2 treating \U as the start of a Unicode escape, even th

Re: 'is not' or '!='

2014-08-19 Thread Skip Montanaro
On Tue, Aug 19, 2014 at 7:42 AM, Martin S wrote: >> For example, in CPython 3.4.1: > (254 + 3) is 257 >> False > (254 + 3) == 257 >> True > ('asd' + '@sd') is 'asd@sd' >> False > ('asd' + '@sd') == 'asd@sd' >> True > > Now you have managed to confuse this newbie: What would a valid

Re: Adapt bash readline operate-and-get-next

2014-08-19 Thread Lele Gaifax
Skip Montanaro writes: > On Tue, Aug 19, 2014 at 3:44 AM, Lele Gaifax wrote: >> Given these lines in the history: >> >> >>> a=10 >> >>> a-=1 >> >>> print(a) >> 9 > > Suppose you have the above, as you indicated. Ctl-P your way back to > the a=10 line. Press Ctl-O. It executes tha

Collaps arrays/ list of intergers

2014-08-19 Thread Jurgens de Bruin
Hi All, I do hope somebody can help me with the following: I have the followings lists which represent the upper and lower value of a range/array. a = [1,50] b = [75,150] c = [25,42] d = [120,149] e = [35,55] What I would like to happen is that overlapping range will "collapse" to a single ran

Re: Adapt bash readline operate-and-get-next

2014-08-19 Thread Skip Montanaro
On Tue, Aug 19, 2014 at 3:44 AM, Lele Gaifax wrote: >> Does your position in the history disappear if you >> operate_and_get_next(), then modify the next recalled input line? > > Not sure what you mean with "disappear": basically o-a-g-n "accepts" the > current line (that is, "executes" it, and th

Re: 'is not' or '!='

2014-08-19 Thread Martin S
2014-08-19 0:04 GMT+02:00 Chris Kaynor : > > On Mon, Aug 18, 2014 at 2:42 PM, Ethan Furman wrote: >> >> If you are not dealing with singletons (which is most cases), such as >> numbers, strings, lists, and most other arbitrary objects, you will need to >> use "!=" or anytime the two objects you ar

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-19 Thread Furqan wasi
Getting this file = ur"C:\Users\Furqan\Desktop\查找問題Reference\1.wav" SyntaxError: (unicode error) 'rawunicodeescape' codec can't decode bytes in position 2-3: truncated \u On Tue, Aug 19, 2014 at 4:05 PM, MRAB wrote: > On 2014-08-19 09:05, Furqan wasi wrote: > >> *Hi Mark and all, * >> >> >

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-19 Thread MRAB
On 2014-08-19 09:05, Furqan wasi wrote: *Hi Mark and all, * Thanks for the replay i appreciate your help but the problem i have is not with the FileNotFoundError exception handling because the file exists but the problem is that the library libsndfile/Sndfile (python third party) which

Re: 'is not' or '!='

2014-08-19 Thread Tim Chase
On 2014-08-19 08:36, Steven D'Aprano wrote: > The English word "is" is the third-person singular simple present > indicative form of "be", Am I the only one who feels the urge to write if i am some_other_object: ... if we are some_other_object: ... if u are some_other_object: ... # though

Re: 'is not' or '!='

2014-08-19 Thread Thomas Rachel
Am 18.08.2014 22:53 schrieb Marko Rauhamaa: Frankly, I don't know of any other object that is "==" to the None object except None itself, but such objects could possible exist. class ImitatingNone(object): def __eq__(self, other): return True # is equal to everything else r

Re: Coding challenge: Optimise a custom string encoding

2014-08-19 Thread Lele Gaifax
Alex Willmer writes: > def plus_encode(s): > """Encode a unicode string with only ascii letters, digits, _, -, @, + > """ > bytemap_ = bytemap > s_utf8 = s.encode('utf-8') > return ''.join([bytemap[byte] for byte in s_utf8]) Minor nit: you defined a local alias for bytemap fo

Re: 'is not' or '!='

2014-08-19 Thread Thomas Rachel
Am 19.08.2014 00:04 schrieb Chris Kaynor: In each of these cases, the behavior may be different in other implementations or versions of Python. And, the most important thing, in each of these cases, using "is" is semantically wrong, so no matter how different versions behave. If you ask the

Re: Adapt bash readline operate-and-get-next

2014-08-19 Thread Lele Gaifax
Lele Gaifax writes: > Chris Angelico writes: > >> On Tue, Aug 19, 2014 at 10:17 AM, Steven D'Aprano >> wrote: >> >>> Can you create a feature request for it on the bug tracker, mark me >>> (steven.daprano) as interested, and upload your diff? >> >> And please mark me (rosuav) as interested ("no

Re: 'is not' or '!='

2014-08-19 Thread alister
On Mon, 18 Aug 2014 23:53:49 +0300, Marko Rauhamaa wrote: > "ElChino" : > >> A newbie question to you; what is the difference between statements >> like: >> if x is not None: >> and if x != None: > > Do the following: take two $10 bills. Hold one bill in the left hand, > hold the other bill in

Re: Python 2.7 IDLE Win32 interactive, pasted characters i- wrong encoding

2014-08-19 Thread Chris Angelico
On Tue, Aug 19, 2014 at 7:03 PM, Terry Reedy wrote: > On 8/18/2014 7:44 PM, Chris Angelico wrote: >> Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit >> (Intel)] on win32 >> Type "copyright", "credits" or "license()" for more information. > > # -*- coding: utf-8 -*- > > > I

Re: Python 2.7 IDLE Win32 interactive, pasted characters i- wrong encoding

2014-08-19 Thread Terry Reedy
On 8/18/2014 7:44 PM, Chris Angelico wrote: Python 3 works fine, at least for BMP characters: Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:24:06) [MSC v.1600 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. u"U+20AC is € is 0x80 in CP-1252" 'U+20A

Re: 'is not' or '!='

2014-08-19 Thread Chris Angelico
On Tue, Aug 19, 2014 at 6:36 PM, Steven D'Aprano wrote: > Why do I know so much about the British royal family??? > > > [2] Of the UK, Australia, and a few other places, but not Denmark, or any > other place with a Queen. Possibly because British royalty is very well-defined, and can be used to e

Re: Adapt bash readline operate-and-get-next

2014-08-19 Thread Lele Gaifax
Chris Angelico writes: > On Tue, Aug 19, 2014 at 10:17 AM, Steven D'Aprano > wrote: > >> Can you create a feature request for it on the bug tracker, mark me >> (steven.daprano) as interested, and upload your diff? > > And please mark me (rosuav) as interested ("nosy"), too Sure, will do that AS

Re: Matplotlib Contour Plots

2014-08-19 Thread Jamie Mitchell
You were right Christian I wanted a shape (2,150). Thank you Rustom and Steven your suggestion has worked. Unfortunately the data doesn't plot as I imagined. What I would like is: X-axis - hs_con_sw Y-axis - te_con_sw Z-axis - Frequency What I would like is for the Z-axis to contour the freque

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-19 Thread Furqan wasi
*Hi Mark and all, * Thanks for the replay i appreciate your help but the problem i have is not with the FileNotFoundError exception handling because the file exists but the problem is that the library libsndfile/Sndfile (python third party) which is child class/module of scikits.audiolab

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-19 Thread Furqan wasi
*yes you are right , it through's this exception that "The system cannot find the path specified." but in fact it exists , so thats why i tried to pass the file name by handling file name by applying different non utf character solution but no of those work * *track_one_file_obj = Sndfile(track1,

Re: Adapt bash readline operate-and-get-next

2014-08-19 Thread Lele Gaifax
Skip Montanaro writes: > Looks reasonable to me, at least if I understand the intent correctly. > I've never used this functionality in bash (wasn't aware it existed). > I assume the intention here is to easily re-execute compound > statements pulled from saved history. Yes, or any arbitrary seq

Re: 'is not' or '!='

2014-08-19 Thread Steven D'Aprano
On Mon, 18 Aug 2014 19:29:11 -0700, Rustom Mody wrote: > On Tuesday, August 19, 2014 2:05:01 AM UTC+5:30, ElChino wrote: >> A newbie question to you; what is the difference between statements >> like: >> if x is not None: >> and >> if x != None: > >> Without any context, which one should be pr

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-19 Thread Mark Lawrence
On 19/08/2014 02:42, Chris Angelico wrote: On Tue, Aug 19, 2014 at 1:34 AM, Furqan wasi wrote: except: print('Simple didnt work') pass Drop all of these bare excepts. Let the exceptions get printed. Believe you me, they are a LOT more helpful than "didnt work". ChrisA Then once

asyncio subprocess PIPE output lost

2014-08-19 Thread yuzhichang
Hi all, I'm new to asyncio introduced by Python 3.4. I created two tasks each pings a host. I noticed some pieces of output will be lost(see "error: found icmp_seq gap"). If I changed to run only one task, this problem never occur. Do you have any idea? Thanks! Zhichang zhichyu@cto-t