Re: easy question, how to double a variable
def twice(parameter = 2) return 4 2009/9/20 daggerdvm : > Write the definition of a function twice , that receives an int > parameter and returns an int that is twice the value of the > parameter. > > how can i do this > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://www.kiloday.com http://www.fourstopspast.com -- http://mail.python.org/mailman/listinfo/python-list
Re: can i write a assemly language programs in python
I wonder if the OP is trying to find out whether python programmes can be compiled and run as stand alone executables. (I know assembly and machine code are not the same, but it might be what they're after.) On windows you can use http://www.py2exe.org/ to bundle python programs into stand alone executables. They're not compiled, but your code and all the modules it relies on are brought together, meaning you can deliver a single exe than can be run like any other windows program. Maybe that helps... 2009/7/9 Gabriel Genellina : > En Thu, 09 Jul 2009 04:17:52 -0300, m.reddy prasad reddy > escribió: > >> can any one tell me how to write assembly language programs in python...if >> no is there any other way to write the programs in python > > You write Python programs using Python, not assembly. > > Perhaps if you provide more info on what you want to do, someone can suggest > a different way... > > -- > Gabriel Genellina > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://www.kiloday.com http://www.fourstopspast.com -- http://mail.python.org/mailman/listinfo/python-list
Re: gett error message: "TypeError: 'int' object is not callable"
Hi, Do you know a good way to avoid running into this problem? It makes sense to suggest not calling variables the same names as built-in functions, but that's hard for a new python programmer who doesn't already know what all the built-in functions are. Over time a programmer will learn which names to avoid, but it's a bit of a pitfall early on. Cheers, Tom 2009/7/9 Richard Brodie : > > "Nick" wrote in message > news:e54c4461-c0b7-42fb-8542-cefd7bf5f...@h18g2000yqj.googlegroups.com... > >> file = open(prefix1) >> text = file.readlines() >> len = len(text) > > You have redefined two built-in functions "file" and "len" in the first three > lines. > This is usually considered poor practice. Stick to meaningless variable names, > it's safer (only joking). > > TypeError: 'int' object is not callable". This means that something you > thought > was a function is in fact an integer. It's helpful to post/look at the line > number of > the error; "how is this line failing", is much easier to answer than > "how is my program failing". > > print len(fields) > > Here len is an integer, because you redefined it in line 3. I'm guessing this > is the > problem. > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://www.kiloday.com http://www.fourstopspast.com -- http://mail.python.org/mailman/listinfo/python-list
Re: A Bug By Any Other Name ...
Maybe the IDE is the best place to warn you of something like that. You could have an IDE where you specify which language you're more familiar with and then have it display warnings likely to be relevant to you. People could collaborate to add support for gradually more niche languages. Python could continue to work the way it was designed to and people documenting python wouldn't have to worry about this kind of issue. :) 2009/7/6 Lawrence D'Oliveiro : > I wonder how many people have been tripped up by the fact that > > ++n > > and > > --n > > fail silently for numeric-valued n. > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://www.kiloday.com http://www.fourstopspast.com -- http://mail.python.org/mailman/listinfo/python-list