Re: unintuitive for-loop behavior

2016-10-01 Thread Jussi Piitulainen
Steve D'Aprano writes: > On Sun, 2 Oct 2016 12:28 am, Jussi Piitulainen wrote: > >> I'm not sure any more to what message this should be a followup, but >> here is a demonstration of two different semantics of the for-loop >> variable scope/update, this time with nested loops using the same >> loo

Re: Merecurial and Python-2.7.x, Python-3.Y

2016-10-01 Thread Terry Reedy
On 10/1/2016 5:31 AM, Michael Felt wrote: Finally, I got to where I understood what needed to be done to get both Mercurial built - and the the new SSL requirements met. So, running: # hg clone https://hg.python.org/cpython works. What is the next step to getting Python-2.7 AND Python-3.7 so I

Re: unintuitive for-loop behavior

2016-10-01 Thread Rustom Mody
On Saturday, October 1, 2016 at 11:35:31 PM UTC+5:30, Steve D'Aprano wrote: > On Sun, 2 Oct 2016 03:57 am, Rustom Mody wrote: > > > Hoo boy1 > > Thats some tour de force and makes my head spin > > I certainly agree with the second part of your sentence. > > > > Point can be made more simply wit

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Paul Rubin
Steve D'Aprano writes: > Yes, this. You need gcc 4.8 or better to build CPython 3.6, and the most > recent any of my systems support is 4.4. Building gcc takes a while but it's reasonably simple. Just start it going and read a book for a while. -- https://mail.python.org/mailman/listinfo/python

Re: inplace text filter - without writing file

2016-10-01 Thread Sayth Renshaw
On Sunday, 2 October 2016 16:19:14 UTC+11, Sayth Renshaw wrote: > On Sunday, 2 October 2016 12:14:43 UTC+11, MRAB wrote: > > On 2016-10-02 01:21, Sayth Renshaw wrote: > > > Hi > > > > > > I have a fileobject which was fine however now I want to delete a line > > > from the file object before yie

Re: inplace text filter - without writing file

2016-10-01 Thread Sayth Renshaw
On Sunday, 2 October 2016 12:14:43 UTC+11, MRAB wrote: > On 2016-10-02 01:21, Sayth Renshaw wrote: > > Hi > > > > I have a fileobject which was fine however now I want to delete a line from > > the file object before yielding. > > > > def return_files(file_list): > > for filename in sorted(fi

Re: unintuitive for-loop behavior

2016-10-01 Thread Chris Angelico
On Sun, Oct 2, 2016 at 3:19 PM, Steve D'Aprano wrote: > In IronPython, you could have the following occur in a function locals, just > as it could happen CPython for globals: > > - delete the name binding "x" > - which triggers a dictionary resize > - bind a value to x again > - because the dictio

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Chris Angelico
On Sun, Oct 2, 2016 at 3:25 PM, Steve D'Aprano wrote: > On Sun, 2 Oct 2016 01:58 pm, Chris Angelico wrote: > >> Hmm, I've possibly missed something here, which may indicate a >> problem. Why can't your existing machines build? Is it because they >> have too-old versions of tools, and if so, which?

Re: unintuitive for-loop behavior

2016-10-01 Thread Steve D'Aprano
On Sun, 2 Oct 2016 11:44 am, Gregory Ewing wrote: > Steve D'Aprano wrote: >> When you say: >> >> x = 0 >> x = 1 >> >> inside a function, and the interpreter does the name binding twice, >> there's no way of telling whether it writes to the same cell each time or >> not. > > Yes, there i

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Steve D'Aprano
On Sun, 2 Oct 2016 01:58 pm, Chris Angelico wrote: > Hmm, I've possibly missed something here, which may indicate a > problem. Why can't your existing machines build? Is it because they > have too-old versions of tools, and if so, which? Yes, this. You need gcc 4.8 or better to build CPython 3.6,

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Steve D'Aprano
On Sun, 2 Oct 2016 12:30 am, Zachary Ware wrote: > On Oct 1, 2016 06:25, "Steve D'Aprano" wrote: >> >> Long story short: I have no working systems capable of compiling the > latest >> Python 3.6, and no time to upgrade my usual machines to something which >> will work. > > Since you're working o

Re: unintuitive for-loop behavior

2016-10-01 Thread Steve D'Aprano
On Sun, 2 Oct 2016 12:28 am, Jussi Piitulainen wrote: > I'm not sure any more to what message this should be a followup, but > here is a demonstration of two different semantics of the for-loop > variable scope/update, this time with nested loops using the same loop > variable name. The first func

Re: announcing fython

2016-10-01 Thread Raoul Fleckman
On 2016-10-02, nicolasessisbre...@gmail.com : > **How does this compare to Python+Numpy? > **How much faster is Fython, and what are the restrictions on the > **Python code? > > Python+Numpy allows easy processing of vector, but there is a limit to > how much user-defined logic can be used with N

Re: inplace text filter - without writing file

2016-10-01 Thread Sayth Renshaw
Thank you -- https://mail.python.org/mailman/listinfo/python-list

Re: announcing fython

2016-10-01 Thread Michael Torrie
On 10/01/2016 09:06 PM, Chris Angelico wrote: > On Sun, Oct 2, 2016 at 1:58 PM, wrote: >> Fython speed is the same as Fortran speed. >> >> There is no restriction on the Python code. >> Once a Fython program is avalaible, Python can throw any scalar or Numpy >> array at it. >> >> For the program

Re: announcing fython

2016-10-01 Thread Chris Angelico
On Sun, Oct 2, 2016 at 1:58 PM, wrote: > Fython speed is the same as Fortran speed. > > There is no restriction on the Python code. > Once a Fython program is avalaible, Python can throw any scalar or Numpy > array at it. > > For the programmer convenience, like Fortran, Fython allows the choice

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Chris Angelico
On Sun, Oct 2, 2016 at 1:51 PM, Steve D'Aprano wrote: > On Sun, 2 Oct 2016 09:31 am, Paul Rubin wrote: > >> Steve D'Aprano writes: >>> However I do have access to another machine (actually a VM) which can >>> compile Python 3.6. It's not practical for me to use it as a my main >>> development mac

Re: announcing fython

2016-10-01 Thread nicolasessisbreton
**How does this compare to Python+Numpy? **How much faster is Fython, and what are the restrictions on the Python code? Python+Numpy allows easy processing of vector, but there is a limit to how much user-defined logic can be used with Numpy. For example, operating on three different arrays to d

Re: announcing fython

2016-10-01 Thread Steve D'Aprano
On Sun, 2 Oct 2016 11:18 am, Raoul Fleckman wrote: > Interested to hear the answers to those questions, and whether Fython is > pass by reference (Fortran) or value (python, unless passing a list, for > example); That's not how Python works. Ints and lists are passed exactly the same way, neithe

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Steve D'Aprano
On Sun, 2 Oct 2016 09:31 am, Paul Rubin wrote: > Steve D'Aprano writes: >> However I do have access to another machine (actually a VM) which can >> compile Python 3.6. It's not practical for me to use it as a my main >> development machine, but as a temporary measure, I thought I could >> compile

Reading the Windows Location API

2016-10-01 Thread Glenn Linderman
I found some GeoLocation stuff on PyPi, but it seems to be focused on turning an IP address into a (rough) location rather than reading a GPS. Seems like if a GPS is attached, reading it would be the best way to obtain a more accurate location, falling back to approximations if there is no GPS.

Re: Byte code descriptions somewhere?

2016-10-01 Thread breamoreboy
On Saturday, October 1, 2016 at 11:57:17 PM UTC+1, Cem Karan wrote: > Hi all, I've all of a sudden gotten interested in the CPython interpreter, > and started trying to understand how it ingests and runs byte code. I found > Include/opcode.h in the python sources, and I found some basic document

Merecurial and Python-2.7.x, Python-3.Y

2016-10-01 Thread Michael Felt
Finally, I got to where I understood what needed to be done to get both Mercurial built - and the the new SSL requirements met. So, running: # hg clone https://hg.python.org/cpython works. What is the next step to getting Python-2.7 AND Python-3.7 so I can submit patches against both versions

Thonny 2.0 released (Python IDE for beginners)

2016-10-01 Thread Aivar Annamaa
Hi! Thonny is Python IDE for learning and teaching programming. It is developed in University of Tartu, Estonia. It has an easy to use debugger which shows clearly how Python executes your programs. Unlike most debuggers, it can even show the steps of evaluating an expression, visually expla

Need help for the print() function with a better order

2016-10-01 Thread 380162267qq
I am trying to print a simple decision tree for my homework. The answer must keep in this format: Top 7,4,0.95 career gain = 100 1.Management 2, 3, 0.9709505944546686 2.Service 5, 1, 0.6500224216483541 location gain = 100 1.Oregon 4, 1, 0.7219280948873623 2.Californ

Re: inplace text filter - without writing file

2016-10-01 Thread MRAB
On 2016-10-02 01:21, Sayth Renshaw wrote: Hi I have a fileobject which was fine however now I want to delete a line from the file object before yielding. def return_files(file_list): for filename in sorted(file_list): When joining paths together, it's better to use 'os.path.join'.

Re: Lawrence D'Oliveiro

2016-10-01 Thread Gregory Ewing
On Fri, 30 Sep 2016 23:29:41 -0700, Paul Rubin declaimed the following: That's the weird Italian spam that the newsgroup has been getting for a while. I've been wondering for a while if anyone knows what the story is, i.e. why it's on comp.lang.python but not on other newsgroups that I've noti

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Gregory Ewing
Sayth Renshaw wrote: def dataAttr(roots): """Get the root object and iter items.""" with open("output/first2.csv", 'w', newline='') as csvf: race_writer = csv.writer(csvf, delimiter=',') for meet in roots.iter("meeting"): The value of roots you're passing in here is a ge

Re: unintuitive for-loop behavior

2016-10-01 Thread Gregory Ewing
Steve D'Aprano wrote: When you say: x = 0 x = 1 inside a function, and the interpreter does the name binding twice, there's no way of telling whether it writes to the same cell each time or not. Yes, there is: ... x = 0 ... f1 = lambda: x ... x = 1 ... f2 = lambda: x ... print(f

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Ned Batchelder
On Saturday, October 1, 2016 at 6:25:16 PM UTC-4, Thorsten Kampe wrote: > * Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100) > > > > Thorsten Kampe writes: > > > > > ConfigParser escapes `\n` in ini values as `\\n`. > > Indenting solves the problem. I'd rather keep it one line per value > but it s

Re: announcing fython

2016-10-01 Thread Chris Angelico
On Sun, Oct 2, 2016 at 11:18 AM, Raoul Fleckman wrote: > Interested to hear the answers to those questions, and whether Fython is > pass by reference (Fortran) or value (python, unless passing a list, for > example); and then there's the 'little' matter of one-based (Fortran) or > zero-based (pyth

Re: Byte code descriptions somewhere?

2016-10-01 Thread Ned Batchelder
On Saturday, October 1, 2016 at 7:48:09 PM UTC-4, Cem Karan wrote: > Cool, thank you! Quick experimentation suggests that I don't need to worry > about marking anything for garbage collection, correct? The next question > is, how do I create a stream of byte codes that can be interpreted by CPy

inplace text filter - without writing file

2016-10-01 Thread Sayth Renshaw
Hi I have a fileobject which was fine however now I want to delete a line from the file object before yielding. def return_files(file_list): for filename in sorted(file_list): with open(dir_path + filename) as fd: for fileItem in fd: yield fileItem Ned

Re: announcing fython

2016-10-01 Thread Raoul Fleckman
On 2016-10-01, Chris Angelico wrote: > On Sat, Oct 1, 2016 at 11:41 PM, wrote: >> Fython permits to write numerical code with the same syntax then Python. >> Under the hood, the code is transpiled to Fortran and run at top speed. > > How does this compare to Python+Numpy? How much faster is Fyth

Converting PyMember_Get usage to PyMember_GetOne - no docs?

2016-10-01 Thread Skip Montanaro
I'm trying to convert the python-sybase module C code from oldish Python 2 usage to work in Python 3. The code currently calls PyMember_Get(), which is obsolete. In later versions of Python 2, PyMember_GetOne became the official way to do things, the the former function was still available. In Pyth

Re: Byte code descriptions somewhere?

2016-10-01 Thread Chris Angelico
On Sun, Oct 2, 2016 at 10:47 AM, Cem Karan wrote: > Cool, thank you! Quick experimentation suggests that I don't need to worry > about marking anything for garbage collection, correct? The next question > is, how do I create a stream of byte codes that can be interpreted by CPython > directly

Re: Byte code descriptions somewhere?

2016-10-01 Thread Paul Rubin
Cem Karan writes: > how do I create a stream of byte codes that can be interpreted by > CPython directly? Basically, study the already existing code and do something similar. The CPython bytecode isn't standardized like JVM bytecode. It's designed for the interpreter's convenience, not officiall

Re: Byte code descriptions somewhere?

2016-10-01 Thread Cem Karan
Cool, thank you! Quick experimentation suggests that I don't need to worry about marking anything for garbage collection, correct? The next question is, how do I create a stream of byte codes that can be interpreted by CPython directly? I don't mean 'use the compile module', I mean writing my

Re: Byte code descriptions somewhere?

2016-10-01 Thread Ben Finney
Cem Karan writes: > Hi all, I've all of a sudden gotten interested in the CPython > interpreter, and started trying to understand how it ingests and runs > byte code. That sounds like fun! > Is there something similar to a manual dedicated to python byte code? The Python documentation for the

Byte code descriptions somewhere?

2016-10-01 Thread Cem Karan
Hi all, I've all of a sudden gotten interested in the CPython interpreter, and started trying to understand how it ingests and runs byte code. I found Include/opcode.h in the python sources, and I found some basic documentation on how to add in new opcodes online, but I haven't found the equiva

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Paul Rubin
Steve D'Aprano writes: > However I do have access to another machine (actually a VM) which can > compile Python 3.6. It's not practical for me to use it as a my main > development machine, but as a temporary measure, I thought I could > compile 3.6 on this VM, then copy the python binary to my usu

Re: RASTER analysis(slope)

2016-10-01 Thread Sayth Renshaw
On Sunday, 2 October 2016 04:52:13 UTC+11, Xristos Xristoou wrote: > hello team > > i want to calculate slope and aspect from some RASTER > IMAGE(.grid,tiff,geotiff) > who is the better method to can i do this ? > with numpy and scipy or with some package? > > > thnx you team I don't know muc

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Thorsten Kampe
* Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100) > > Thorsten Kampe writes: > > > ConfigParser escapes `\n` in ini values as `\\n`. Indenting solves the problem. I'd rather keep it one line per value but it solves the problem. Thorsten -- https://mail.python.org/mailman/listinfo/python-list

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Chris Angelico
On Sat, Oct 1, 2016 at 11:03 PM, Steve D'Aprano wrote: >> Are both Linuxes of broadly similar vintage? > > That depends on what you mean by "broadly similar". As far as I am > concerned, a five year difference is not very much, and is broadly > similar -- it's not like I'm using Linux from 1991. B

Re: announcing fython

2016-10-01 Thread Chris Angelico
On Sat, Oct 1, 2016 at 11:41 PM, wrote: > Fython permits to write numerical code with the same syntax then Python. > Under the hood, the code is transpiled to Fortran and run at top speed. How does this compare to Python+Numpy? How much faster is Fython, and what are the restrictions on the Pyth

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Thorsten Kampe
* Terry Reedy (Sat, 1 Oct 2016 15:44:39 -0400) > > On 10/1/2016 10:56 AM, Thorsten Kampe wrote: > > > ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to > > signal to ConfigParser that there is a line break? > > Without an example or two, I don't really understand the question e

Re: unintuitive for-loop behavior

2016-10-01 Thread Terry Reedy
On 10/1/2016 8:24 AM, Rustom Mody wrote: Yeah by comprehension-variable I mean the one that sits left of the ‘in’ inside the conprehension. In other words, a 'loop variable within a comprehension'. Keep in mind that there may be multiple targets for the implicit (hidden) assignment, so ther

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Ben Finney
Thorsten Kampe writes: > ConfigParser escapes `\n` in ini values as `\\n`. How do you demonstrate that? Here is an example text of a config file:: >>> import io >>> import textwrap >>> config_text = textwrap.dedent(r""" ... [foo] ... wibble = Lorem\nipsum. ...

Re: rocket simulation game with just using tkinter

2016-10-01 Thread Irmen de Jong
On 1-10-2016 15:44, Christian Gollwitzer wrote: > Am 01.10.16 um 00:59 schrieb Irmen de Jong: >> Hi, >> >> I've made a very simple rocket simulation game, inspired by the recent >> success of SpaceX > >> You can get the code here if you want to give it a try: >> https://github.com/irmen/rocketsim

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Terry Reedy
On 10/1/2016 10:56 AM, Thorsten Kampe wrote: ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to signal to ConfigParser that there is a line break? Without an example or two, I don't really understand the question enough to answer. -- Terry Jan Reedy -- https://mail.python.

Re: unintuitive for-loop behavior

2016-10-01 Thread Steve D'Aprano
On Sun, 2 Oct 2016 03:57 am, Rustom Mody wrote: > Hoo boy1 > Thats some tour de force and makes my head spin I certainly agree with the second part of your sentence. > Point can be made more simply with map > ie if we *define* > [exp for cv in l] > as > map(lambda cv: exp, l) > > the problem v

RASTER analysis(slope)

2016-10-01 Thread Xristos Xristoou
hello team i want to calculate slope and aspect from some RASTER IMAGE(.grid,tiff,geotiff) who is the better method to can i do this ? with numpy and scipy or with some package? thnx you team -- https://mail.python.org/mailman/listinfo/python-list

Re: unintuitive for-loop behavior

2016-10-01 Thread Rustom Mody
On Saturday, October 1, 2016 at 7:02:58 PM UTC+5:30, Jussi Piitulainen wrote: > Rustom Mody writes: > > > And then define comprehensions not as now done in terms of for loops > > that mutatingly extend the list being built up but as recursive > > functions that get (re)called for every new value o

ConfigParser: use newline in INI file

2016-10-01 Thread Thorsten Kampe
Hi, ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to signal to ConfigParser that there is a line break? Thorsten -- https://mail.python.org/mailman/listinfo/python-list

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Zachary Ware
On Oct 1, 2016 06:25, "Steve D'Aprano" wrote: > > Long story short: I have no working systems capable of compiling the latest > Python 3.6, and no time to upgrade my usual machines to something which > will work. Since you're working on a pure-Python module (statistics), I'd recommend updating to

Re: unintuitive for-loop behavior

2016-10-01 Thread Jussi Piitulainen
I'm not sure any more to what message this should be a followup, but here is a demonstration of two different semantics of the for-loop variable scope/update, this time with nested loops using the same loop variable name. The first function, tabulate, uses Python semantics ("t" for true, if you lik

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Michael Torrie
On 10/01/2016 05:21 AM, Steve D'Aprano wrote: > Long story short: I have no working systems capable of compiling the > latest Python 3.6, and no time to upgrade my usual machines to > something which will work. > > However I do have access to another machine (actually a VM) which > can compile Pyt

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Sayth Renshaw
> Steve > “Cheer up,” they said, “things could be worse.” So I cheered up, and sure > enough, things got worse. Loving life. I first started with a simple with open on a file, which allowed me to use code that "iter"'s. for example: for meet in root.iter("meeting"): for race in root.ite

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Grant Edwards
On 2016-10-01, Steve D'Aprano wrote: > Does gcc support static linking? Yes, but the real question is the CPython makefile includes recipes for a statically-linked target. > Even if I end up with a much bigger binary, at least I know it will > have everything it needs to run and I won't have to

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Grant Edwards
On 2016-10-01, Steve D'Aprano wrote: > Long story short: I have no working systems capable of compiling the > latest Python 3.6, and no time to upgrade my usual machines to > something which will work. > > However I do have access to another machine (actually a VM) which can > compile Python 3.6.

Re: rocket simulation game with just using tkinter

2016-10-01 Thread Christian Gollwitzer
Am 01.10.16 um 00:59 schrieb Irmen de Jong: Hi, I've made a very simple rocket simulation game, inspired by the recent success of SpaceX You can get the code here if you want to give it a try: https://github.com/irmen/rocketsimulator Nice! I'll have to rebind the keys before I can successf

announcing fython

2016-10-01 Thread nicolasessisbreton
Hi All, I would like to announce a new project call Fython. In short, Fython is Fortran with a Python syntax. Fython permits to write numerical code with the same syntax then Python. Under the hood, the code is transpiled to Fortran and run at top speed. Fython primary goal is to facilitate nume

Re: unintuitive for-loop behavior

2016-10-01 Thread Jussi Piitulainen
Rustom Mody writes: > And then define comprehensions not as now done in terms of for loops > that mutatingly extend the list being built up but as recursive > functions that get (re)called for every new value of the comprehension > variable passed and therefore fresh-bound as parameter You'd get

Re: unintuitive for-loop behavior

2016-10-01 Thread Steve D'Aprano
On Sat, 1 Oct 2016 09:33 pm, Gregory Ewing wrote: > Steve D'Aprano wrote: > >> # create a new binding >> x: address 1234 > [ box contains 999 ] >> x: address 5678 > [ a different box, containing 888 ] > > In the context of CPython and nested functions, replace > "box" with "cell". Ce

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Steve D'Aprano
On Sat, 1 Oct 2016 10:01 pm, Chris Angelico wrote: >> [...] I thought I could >> compile 3.6 on this VM, then copy the python binary to my usual desktop >> machine. >> >> What sort of challenges am I likely to find? Both machines are Linux, but >> different distros. > > First off, are they the sa

Re: unintuitive for-loop behavior

2016-10-01 Thread Rustom Mody
On Saturday, October 1, 2016 at 5:02:30 PM UTC+5:30, Steve D'Aprano wrote: > On Sat, 1 Oct 2016 01:44 pm, Rustom Mody wrote: > > > Yes one basic problem with comprehensions in python is that they are > > defined by assignment not binding to the comprehension variable > > ¿Que Mr Fawlty? > > I'm

Re: Copying a compiled Python from one system to another

2016-10-01 Thread Chris Angelico
On Sat, Oct 1, 2016 at 9:21 PM, Steve D'Aprano wrote: > Long story short: I have no working systems capable of compiling the latest > Python 3.6, and no time to upgrade my usual machines to something which > will work. > > However I do have access to another machine (actually a VM) which can > com

Re: unintuitive for-loop behavior

2016-10-01 Thread Gregory Ewing
Steve D'Aprano wrote: # create a new binding x: address 1234 > [ box contains 999 ] x: address 5678 > [ a different box, containing 888 ] In the context of CPython and nested functions, replace "box" with "cell". When I said "creating a new binding" I meant that the name x refers to

Re: unintuitive for-loop behavior

2016-10-01 Thread Steve D'Aprano
On Sat, 1 Oct 2016 01:44 pm, Rustom Mody wrote: > Yes one basic problem with comprehensions in python is that they are > defined by assignment not binding to the comprehension variable ¿Que Mr Fawlty? I'm sorry, I don't understand you. In Python, all assignments are name bindings. So you seem t

Copying a compiled Python from one system to another

2016-10-01 Thread Steve D'Aprano
Long story short: I have no working systems capable of compiling the latest Python 3.6, and no time to upgrade my usual machines to something which will work. However I do have access to another machine (actually a VM) which can compile Python 3.6. It's not practical for me to use it as a my main

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Steve D'Aprano
On Sat, 1 Oct 2016 06:52 pm, Sayth Renshaw wrote: > Evening > > My file list handler I have created a generator. > > Before I created it as a generator I was able to use iter on my lxml root > objects, now I cannot iter. lxml root objects have an iter method. Other objects do not. Thank you f

Re: unintuitive for-loop behavior

2016-10-01 Thread Gregory Ewing
Random832 wrote: > for a in collection: > b = some_calculation_of(a) > final b: do_something_with(lambda: ... b ...) I would prefer something like for a in collection: let b = some_calculation_of(a): do_something_with(lambda: ... b ...) -- Greg -- https://mail.python.org/ma

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Vlastimil Brom
2016-10-01 12:09 GMT+02:00 Sayth Renshaw : > My main issue is that usually its just x in ,,, for a generator. > > But if I change the code > for meet in roots.iter("meeting"): > > to > for meet in roots("meeting"): > > Well its invalid but I need to be able to reference the node, how do I > achiev

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Sayth Renshaw
My main issue is that usually its just x in ,,, for a generator. But if I change the code for meet in roots.iter("meeting"): to for meet in roots("meeting"): Well its invalid but I need to be able to reference the node, how do I achieve this? Sayth -- https://mail.python.org/mailman/listinfo/

Re: How to make a foreign function run as fast as possible in Windows?

2016-10-01 Thread jfong
Chris Angelico at 2016/10/1 11:25:03AM wrote: > What's it doing? Not every task can saturate the CPU - sometimes they > need the disk or network more. > This function has no I/O or similar activity, just pure data processing, and it takes less than 200 bytes of data area to work with. My CPU is

Re: unintuitive for-loop behavior

2016-10-01 Thread Chris Angelico
On Sat, Oct 1, 2016 at 6:35 PM, Steve D'Aprano wrote: > On Sat, 1 Oct 2016 02:39 am, Chris Angelico wrote: > >> On Sat, Oct 1, 2016 at 12:36 AM, Grant Edwards >> wrote: > >>> In C99 a for loop has its own namespac: > [...] > >> I believe that's the same semantics as C++ uses, and I agree, it's >>

Re: rocket simulation game with just using tkinter

2016-10-01 Thread Sayth Renshaw
On Saturday, 1 October 2016 08:59:28 UTC+10, Irmen de Jong wrote: > Hi, > > I've made a very simple rocket simulation game, inspired by the recent > success of SpaceX > where they managed to land the Falcon-9 rocket back on a platform. > > I was curious if you can make a simple graphics animati

generator no iter - how do I call it from another function

2016-10-01 Thread Sayth Renshaw
Evening My file list handler I have created a generator. Before I created it as a generator I was able to use iter on my lxml root objects, now I cannot iter. ± |master U:2 ?:1 ✗| → python3 race.py data/ -e *.xml Traceback (most recent call last): File "race.py", line 83, in dataAttr(roo

Re: unintuitive for-loop behavior

2016-10-01 Thread Jussi Piitulainen
Steve D'Aprano writes: > In a language like Python, the only distinction we can make between > name bindings is, which namespace is the binding in? In other words, > what is the current block of code's scope? Python already has nested scopes. A local scope for just those variables introduced in f

Re: unintuitive for-loop behavior

2016-10-01 Thread Steve D'Aprano
On Sat, 1 Oct 2016 02:39 am, Chris Angelico wrote: > On Sat, Oct 1, 2016 at 12:36 AM, Grant Edwards > wrote: >> In C99 a for loop has its own namespac: [...] > I believe that's the same semantics as C++ uses, and I agree, it's > very convenient. Among other things, it means that nested loops be

Re: unintuitive for-loop behavior

2016-10-01 Thread Chris Angelico
On Sat, Oct 1, 2016 at 5:06 PM, Steve D'Aprano wrote: > Earlier, I wrote: > >> On Sat, 1 Oct 2016 10:46 am, Gregory Ewing wrote: > [...] >>> Whenever there's binding going on, it's necessary to decide >>> whether it should be creating a new binding or updating an >>> existing one. >> >> Right. > >

Re: unintuitive for-loop behavior

2016-10-01 Thread Steve D'Aprano
Earlier, I wrote: > On Sat, 1 Oct 2016 10:46 am, Gregory Ewing wrote: [...] >> Whenever there's binding going on, it's necessary to decide >> whether it should be creating a new binding or updating an >> existing one. > > Right. I changed my mind -- I don't think that's correct. I think Greg's