Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-12 Thread mad scientist jr
Thanks for your reply! On Saturday, June 11, 2016 at 2:41:39 PM UTC-4, MRAB wrote: > Drop the next 3 comment lines. They add visual clutter, and no useful info. > > ### > > # REFERENCE MODULES > > #

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-11 Thread MRAB
On 2016-06-11 18:59, mad scientist jr wrote: Thanks to everyone for your replies. I see my script was as horrific as I feared, but I read all the responses and made a few changes. I'm not 100% sold on not checking types, but took it out, because it made sense that other programmers might wan

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-11 Thread Marc Brooks
Look into docstrings. They will make your code much more readable to a Python reader. On Sat, Jun 11, 2016 at 2:16 PM mad scientist jr wrote: > For those who don't want to have to wade through comments, here is a > version without so many comments: > > # For Python 3.x > # This script creates mul

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-11 Thread mad scientist jr
For those who don't want to have to wade through comments, here is a version without so many comments: # For Python 3.x # This script creates multiple numbered empty folders # in the desired location. To change the folder names # or location, edit function get_default_options. import datetime im

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-11 Thread mad scientist jr
Thanks to everyone for your replies. I see my script was as horrific as I feared, but I read all the responses and made a few changes. I'm not 100% sold on not checking types, but took it out, because it made sense that other programmers might want to use some custom type with my functions for

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Matt Wheeler
First of all welcome :) The other suggestions you've received so far are good so I won't repeat them... (note that in particular I've reused the names you've chosen in your program where I've given code examples, but that's purely for clarity and I agree with the others who've said you should use

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Larry Hudson via Python-list
On 06/10/2016 03:52 PM, mad scientist jr wrote: Is this group appropriate for that kind of thing? (If not sorry for posting this here.) So I wanted to start learning Python, and there is s much information online, which is a little overwhelming. I really learn best from doing, especially i

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Joel Goldstick
On Fri, Jun 10, 2016 at 6:52 PM, mad scientist jr wrote: > Is this group appropriate for that kind of thing? > (If not sorry for posting this here.) > > So I wanted to start learning Python, and there is s much information > online, which is a little overwhelming. I really learn best from doi

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Marc Brooks
The structure of your program is really not that Pythonic. I'd recommend you take a look at PEP 8. https://www.python.org/dev/peps/pep-0008/ It's not perfect, but it's a good start to get a feel for how to structure your Python work. Marc On Fri, Jun 10, 2016 at 7:05 PM, Christopher Reimer < c

Re: i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread Christopher Reimer
Sent from my iPhone > On Jun 10, 2016, at 3:52 PM, mad scientist jr > wrote: > . > Now that it's done, I am wondering what kind of things I could do better. This is Python, not BASIC. Lay off on the CAP LOCK key and delete all the comments and separation blocks. No one is going to find your

i'm a python newbie & wrote my first script, can someone critique it?

2016-06-10 Thread mad scientist jr
Is this group appropriate for that kind of thing? (If not sorry for posting this here.) So I wanted to start learning Python, and there is s much information online, which is a little overwhelming. I really learn best from doing, especially if it's something actually useful. I needed to cre

Re: Python newbie here! No module named settings

2015-04-12 Thread rdavis7408
On Thursday, June 2, 2011 at 10:29:48 AM UTC-5, Neeraj Agarwal wrote: > Hello all, > > I'm a newbie to Python and its my 2nd day exploring it. > > I was trying to use Python wrapper for Google Charts API and was > tweaking the examples. > https://github.com/gak/pygooglechart/raw/master/examples/p

Re: Case-insensitive sorting of strings (Python newbie)

2015-01-23 Thread Chris Angelico
On Sat, Jan 24, 2015 at 6:14 AM, Marko Rauhamaa wrote: > Well, if Python can't, then who can? Probably nobody in the world, not > generically, anyway. > > Example: > > >>> print("re\u0301sume\u0301") > résumé > >>> print("r\u00e9sum\u00e9") > résumé > >>> print("re\u0301sume\u0

Re: Case-insensitive sorting of strings (Python newbie)

2015-01-23 Thread Marko Rauhamaa
Peter Otten <__pete...@web.de>: > The standard recommendation is to convert bytes to unicode as early as > possible and only manipulate unicode. Unicode doesn't get you off the hook (as you explain later in your post). Upper/lowercase as well as collation order is ambiguous. Python even with dece

Re: Case-insensitive sorting of strings (Python newbie)

2015-01-23 Thread Steven D'Aprano
John Sampson wrote: > I notice that the string method 'lower' seems to convert some strings > (input from a text file) to Unicode but not others. I don't think so. You're going to have to show an example. I *think* what you might be running into is an artifact of printing to a terminal, which ma

Re: Case-insensitive sorting of strings (Python newbie)

2015-01-23 Thread Chris Angelico
On Sat, Jan 24, 2015 at 4:53 AM, Peter Otten <__pete...@web.de> wrote: > Now the same with unicode. To read text with a specific encoding use either > codecs.open() or io.open() instead of the built-in (replace utf-8 with your > actual encoding): > import io for line in io.open("tmp.txt",

Re: Case-insensitive sorting of strings (Python newbie)

2015-01-23 Thread Peter Otten
John Sampson wrote: > I notice that the string method 'lower' seems to convert some strings > (input from a text file) to Unicode but not others. > This messes up sorting if it is used on arguments of 'sorted' since > Unicode strings come before ordinary ones. > > Is there a better way of case-in

Re: Case-insensitive sorting of strings (Python newbie)

2015-01-23 Thread Michael Ströder
John Sampson wrote: > I notice that the string method 'lower' seems to convert some strings (input > from a text file) to Unicode but not others. > This messes up sorting if it is used on arguments of 'sorted' since Unicode > strings come before ordinary ones. I doubt that. Can you provide a short

Case-insensitive sorting of strings (Python newbie)

2015-01-23 Thread John Sampson
I notice that the string method 'lower' seems to convert some strings (input from a text file) to Unicode but not others. This messes up sorting if it is used on arguments of 'sorted' since Unicode strings come before ordinary ones. Is there a better way of case-insensitive sorting of strings i

Re: python newbie

2014-06-18 Thread Jim Gibson
In article , Maura E Monville wrote: > My supervisor has palmed me off with a python code, written by a > collaborator, which implements an algorithm aimed at denoising the dose > distribution (energy per unit mass) output from a radiation transport Monte > Carlo code. > My task is to translate t

Re: python newbie

2014-06-18 Thread Maura E Monville
On Wednesday, June 18, 2014 1:50:54 PM UTC+1, Steven D'Aprano wrote: > On Wed, 18 Jun 2014 05:10:03 -0700, Maura E Monville wrote: > > > > > My supervisor has palmed me off with a python code, written by a > > > collaborator, which implements an algorithm aimed at denoising the dose > > > dist

Re: python newbie

2014-06-18 Thread Steven D'Aprano
On Wed, 18 Jun 2014 05:10:03 -0700, Maura E Monville wrote: > My supervisor has palmed me off with a python code, written by a > collaborator, which implements an algorithm aimed at denoising the dose > distribution (energy per unit mass) output from a radiation transport > Monte Carlo code. My ta

python newbie

2014-06-18 Thread Maura E Monville
My supervisor has palmed me off with a python code, written by a collaborator, which implements an algorithm aimed at denoising the dose distribution (energy per unit mass) output from a radiation transport Monte Carlo code. My task is to translate the python code into a MatLab code. A colleague

Re: Total Python Newbie needs geting started info.

2013-11-20 Thread Christopher Welborn
On 11/20/2013 10:03 AM, Ev J wrote: I am learning Python and wish to develop GUI applications to run on Windows. I have installed the Visual Studio integrated shell (Ver. 12.0.21005.1 REL) IDE and the Python 3.3 interpreter. I have gone through some of the 3.3 tutorial available at http://docs.

Re: Total Python Newbie needs geting started info.

2013-11-20 Thread Rod Person
On 11/20/2013 11:03 AM, Ev J wrote: I am learning Python and wish to develop GUI applications to run on Windows. I have installed the Visual Studio integrated shell (Ver. 12.0.21005.1 REL) IDE and the Python 3.3 interpreter. I have gone through some of the 3.3 tutorial available at http://docs.

Re: Total Python Newbie needs geting started info.

2013-11-20 Thread Alister
On Thu, 21 Nov 2013 03:14:44 +1100, Chris Angelico wrote: > On Thu, Nov 21, 2013 at 3:03 AM, Ev J wrote: >> Before I go too far down this road, I need to know if I can/should use >> this environment to develop GUI applications. Is there graphical >> support for this - for example I can I just in

Re: Total Python Newbie needs geting started info.

2013-11-20 Thread Chris Angelico
On Thu, Nov 21, 2013 at 3:03 AM, Ev J wrote: > Before I go too far down this road, I need to know if I can/should use this > environment to develop GUI applications. Is there graphical support for this > - for example I can I just insert/move/set properties of buttons, combo > boxes, etc. usin

Total Python Newbie needs geting started info.

2013-11-20 Thread Ev J
I am learning Python and wish to develop GUI applications to run on Windows. I have installed the Visual Studio integrated shell (Ver. 12.0.21005.1 REL) IDE and the Python 3.3 interpreter. I have gone through some of the 3.3 tutorial available at http://docs.python.org/3.3/tutorial/. The tutoria

Re: Python newbie trying to embed in C++

2013-02-28 Thread Michael Torrie
On 02/28/2013 03:47 AM, Gisle Vanem wrote: > I saw you uses Thunderbird on Windows. I'm not sure how it by default handles > a reply-to when there is no "Reply-to" field in the header. To the address in > "From" / "Sender" or what? Thunderbird has a handy, "reply to list" button that works every

Re: Python newbie trying to embed in C++

2013-02-28 Thread Gisle Vanem
"Marwan Badawi" wrote: I just noticed that my reply went to the message sender and not to the newsgroup, so I'm posting again: thanks, I'll look into that. Yes, I often do that too; i.e. I'm subscribed to python-list@python.org and get all messages from comp.lang.python mirrored to the ML a b

Re: Python newbie trying to embed in C++

2013-02-28 Thread Marwan Badawi
On 27/02/2013 16:17, Christian Gollwitzer wrote: Am 27.02.13 09:51, schrieb Marwan: And I'd appreciate it if you could give me pointers to how to easily call Python from C++. Maybe you can use boost::python? http://www.boost.org/doc/libs/1_53_0/libs/python/doc/ Cave: I haven't used it and do

Re: Python newbie trying to embed in C++

2013-02-28 Thread Marwan Badawi
On 27/02/2013 10:26, Ian Kelly wrote: On Wed, Feb 27, 2013 at 1:51 AM, Marwan wrote: When I run the generated exe, I get errors about the functions not existing... TestPython.exe test Hello AttributeError: 'module' object has no attribute 'Hello' Cannot find function "Hello" "test" is the na

Re: Python newbie trying to embed in C++

2013-02-27 Thread Terry Reedy
On 2/27/2013 3:51 AM, Marwan wrote: Hello all, I'm new to Python and just starting to learn it. For he needs of my project, I need to call some specific methods in Python scripts from C++. For now, I just compiled the example in the Python documentation about Pure Embedding to try it out ( http

Re: Python newbie trying to embed in C++

2013-02-27 Thread Christian Gollwitzer
Am 27.02.13 09:51, schrieb Marwan: And I'd appreciate it if you could give me pointers to how to easily call Python from C++. Maybe you can use boost::python? http://www.boost.org/doc/libs/1_53_0/libs/python/doc/ Cave: I haven't used it and don't know if it is up-to-date. Christian

Re: Python newbie trying to embed in C++

2013-02-27 Thread Ian Kelly
On Wed, Feb 27, 2013 at 1:51 AM, Marwan wrote: > When I run the generated exe, I get errors about the functions not > existing... > > TestPython.exe test Hello > AttributeError: 'module' object has no attribute 'Hello' > Cannot find function "Hello" "test" is the name of a module in the standard

Python newbie trying to embed in C++

2013-02-27 Thread Marwan
Hello all, I'm new to Python and just starting to learn it. For he needs of my project, I need to call some specific methods in Python scripts from C++. For now, I just compiled the example in the Python documentation about Pure Embedding to try it out ( http://docs.python.org/2/extending/em

Re: Python Newbie

2013-02-26 Thread rurpy
On Tuesday, February 26, 2013 11:59:51 AM UTC-7, Ethan Furman wrote: > On 02/26/2013 10:23 AM, ru...@yahoo.com wrote: > > On 02/26/2013 01:32 AM, Larry Hudson wrote: > >> Python variables do NOT have any data type. > > I have no problem interpreting the OP's statement > > as meaning that he wanted

Re: Python Newbie

2013-02-26 Thread Chris Angelico
On Wed, Feb 27, 2013 at 6:42 AM, Piterrr wrote: > This reminds me, when I first started working with databases and saw an > error msg which said that my query had "ambiguous columns" I laughed for 1/2 > hr. I found it incredibly exitaining that a 100% deterministic piece of > hardware could have t

Re: Python Newbie

2013-02-26 Thread Piterrr
"Jean-Michel Pichavant" wrote in message news:mailman.2567.1361905815.2939.python-l...@python.org... - Original Message - Hi guys, Question. Have this code intX = 32 # decl + init int var intX_asString = None # decl + init with NULL string var

Re: Python Newbie

2013-02-26 Thread Ethan Furman
On 02/26/2013 10:23 AM, ru...@yahoo.com wrote: On 02/26/2013 01:32 AM, Larry Hudson wrote: Python variables do NOT have any data type. I have no problem interpreting the OP's statement as meaning that he wanted to use a Python variable to consistently reference a particular type and wanted a n

Re: Python Newbie

2013-02-26 Thread Jean-Michel Pichavant
- Original Message - > Hi guys, > > Question. Have this code > > intX = 32 # decl + init int var > intX_asString = None # decl + init with NULL string var > > intX_asString = intX.__str__ ()# convert int to string > > What are these ugly under

Re: Python Newbie

2013-02-26 Thread rurpy
On 02/26/2013 01:32 AM, Larry Hudson wrote: > On 02/24/2013 02:43 PM, piterrr.dolin...@gmail.com wrote: > >> ... But for the moment I am trying to imitate familiar ground. > > This is EXACTLY why you're having trouble grasping Python. Python is a > different language and > requires a differen

Re: Python Newbie

2013-02-26 Thread Matej Cepl
On 2013-02-23, 18:44 GMT, jmfauth wrote: > Very easy to explain: wrong, incorrect, naive unicode > handling. PLONK! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Newbie

2013-02-26 Thread Matej Cepl
On 2013-02-23, 15:51 GMT, Chris Angelico wrote: > When you learn your first language, you think you're learning to > program, but that's not really accurate. Once you've learned half a > dozen, you begin to understand something of the art of coding as > distinct from any particular language; after

Re: Python Newbie

2013-02-26 Thread Larry Hudson
On 02/24/2013 02:43 PM, piterrr.dolin...@gmail.com wrote: ... But for the moment I am trying to imitate familiar ground. This is EXACTLY why you're having trouble grasping Python. Python is a different language and requires a different mind-set and different approach. In this, it is NO dif

Re: Python Newbie

2013-02-25 Thread Nick Mellor
Hi Piterr, It's interesting how strong our habits are, isn't it? It's most likely you've just got a bit of culture shock. I've used C# quite a bit as well as Python. I like them both. What I like about Python is how it manages to be clear and terse at the same time. if (flag==1) { code }

Re: Python Newbie

2013-02-25 Thread Serhiy Storchaka
On 24.02.13 17:52, Chris Angelico wrote: By the way, when you're asking a completely new question, it usually helps to do so as a brand new thread (not a reply) and with a new subject line. Otherwise, you risk people losing the new question among the discussion of the old. You risk people losin

Re: Python Newbie

2013-02-24 Thread Ethan Furman
On 02/24/2013 05:53 PM, Chris Angelico wrote: On Mon, Feb 25, 2013 at 12:44 PM, Oscar Benjamin wrote: On 25 February 2013 01:24, Chris Angelico wrote: Once again, Ethan gets the short end of the citations stick... 'twarn't me wrote that, he did. Not that it's at all contrary to my views, and

Re: Python Newbie

2013-02-24 Thread Joshua Landau
On 25 February 2013 02:08, Dennis Lee Bieber wrote: > On Sun, 24 Feb 2013 21:58:36 +, Joshua Landau > declaimed the following in > gmane.comp.python.general: > > > > > > condition1 = long_condition_expression_1 > > condition2 = long_condition_expression_2 > > condition3 = long_condition_expr

Re: Python Newbie

2013-02-24 Thread J.R.
On 24/02/2013 23:03, Roy Smith wrote: In article , "J.R." wrote: PS.: JavaScript is a trademark, and the actual language name is specified as ECMAScript. The decision whether to call it JavaScript or ECMAScript really comes down to, "Do you want to be correct, or do you want people to know

Re: Python Newbie

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 1:03 PM, Roy Smith wrote: > In article , > "J.R." wrote: > >> PS.: JavaScript is a trademark, and the actual language name is >> specified as ECMAScript. > > The decision whether to call it JavaScript or ECMAScript really comes > down to, "Do you want to be correct, or do

Re: Python Newbie

2013-02-24 Thread MRAB
On 2013-02-25 01:53, Chris Angelico wrote: On Mon, Feb 25, 2013 at 12:44 PM, Oscar Benjamin wrote: On 25 February 2013 01:24, Chris Angelico wrote: Once again, Ethan gets the short end of the citations stick... 'twarn't me wrote that, he did. Not that it's at all contrary to my views, and I m

Re: Python Newbie

2013-02-24 Thread Roy Smith
In article , "J.R." wrote: > PS.: JavaScript is a trademark, and the actual language name is > specified as ECMAScript. The decision whether to call it JavaScript or ECMAScript really comes down to, "Do you want to be correct, or do you want people to know what you're talking about?" -- htt

Re: Python Newbie

2013-02-24 Thread J.R.
On 21/02/2013 19:40, piterrr.dolin...@gmail.com wrote: I am nervous about using variables "out of the blue", without having to declare them. For example, when I write "i = 0" it is perfectly OK to Python without 'i' being declared earlier. How do I know that I haven't used this variable earlie

Re: Python Newbie

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 12:44 PM, Oscar Benjamin wrote: > On 25 February 2013 01:24, Chris Angelico wrote: >> Once again, Ethan gets the short end of the citations stick... >> 'twarn't me wrote that, he did. Not that it's at all contrary to my >> views, and I might well have said it if he hadn't,

Re: Python Newbie

2013-02-24 Thread Michael Torrie
On 02/24/2013 03:43 PM, piterrr.dolin...@gmail.com wrote: > I wanted Python to register what type of variable I'm after. So I > init my vars accordingly, int might be 0, float 0.0 and string with > null, err... None. As several people on the list have pointed out, there are no variables in Python.

Re: Python Newbie

2013-02-24 Thread Oscar Benjamin
On 25 February 2013 01:24, Chris Angelico wrote: > On Mon, Feb 25, 2013 at 11:45 AM, Oscar Benjamin > wrote: >> On 25 February 2013 00:08, wrote: >> Chris Angelico wrote: For example (I believe it's already been mentioned) "declaring" intX with some integer value does *nothing* to ma

Re: Python Newbie

2013-02-24 Thread Michael Torrie
On 02/24/2013 06:04 PM, Steven D'Aprano wrote: > Variables do not have types in Python. > > Reset your thinking. Python is a dynamic language with name bindings and > strongly-typed objects, not a static language with strongly-typed > variables. If you don't understand the difference, ask. But s

Re: Python Newbie

2013-02-24 Thread Michael Torrie
On 02/24/2013 03:40 PM, Mitya Sirenef wrote: > But if block doesn't have to be inside a function, right? It needs > to be inside a module, but then again everything is inside a module, but > it wouldn't be very object-oriented if the module was the only object in > Python :-). A module indeed fits

Re: Python Newbie

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 12:04 PM, Steven D'Aprano wrote: > Not at all. The only difference is whether you get a compiler error or a > runtime error. Instead of: > > 10 Write code. > 20 Compile. > 30 If compiler error, GO TO 10. > 40 REM code compiles, but it still needs to be tested > 50 Test code

Re: Python Newbie

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 11:45 AM, Oscar Benjamin wrote: > On 25 February 2013 00:08, wrote: > Chris Angelico wrote: >>> For example (I believe it's already been mentioned) "declaring" intX with >>> some integer value does *nothing* to maintain >>> >>> X as an integer: >>> >>> --> intX = 32 >>>

Re: Python Newbie

2013-02-24 Thread Steven D'Aprano
On Sun, 24 Feb 2013 17:40:54 -0500, Mitya Sirenef wrote: > But if block doesn't have to be inside a function, right? It needs to be > inside a module, but then again everything is inside a module, but it > wouldn't be very object-oriented if the module was the only object in > Python :-). Python

Re: Python Newbie

2013-02-24 Thread Steven D'Aprano
On Sun, 24 Feb 2013 16:08:06 -0800, piterrr.dolinski wrote: >> For example (I believe it's already been mentioned) "declaring" intX >> with some integer value does *nothing* to maintain >> >> X as an integer: >> >> --> intX = 32 >> >> --> intX = intX / 3.0 >> >> --> intX >> >> 10.66 >

Re: Python Newbie

2013-02-24 Thread Steven D'Aprano
On Sun, 24 Feb 2013 11:40:05 -0800, piterrr.dolinski wrote: >> > if (some statement): # short form >> > >> > rather than >> > >> > if (some statement == true): # long form >> >> >> What all those ugly brackets are for? >> >> > Mark, > > Back in the day when C was king, or

Re: Python Newbie

2013-02-24 Thread Roy Smith
In article , piterrr.dolin...@gmail.com wrote: > Yes I did see that it is possible to redefine the type of a variable. But I > don't think I would ever do this intentionally One does not need language features to protect themselves against things they do intentionally. They need language feat

Re: Python Newbie

2013-02-24 Thread Oscar Benjamin
On 25 February 2013 00:08, wrote: Chris Angelico wrote: >> For example (I believe it's already been mentioned) "declaring" intX with >> some integer value does *nothing* to maintain >> >> X as an integer: >> >> --> intX = 32 >> >> --> intX = intX / 3.0 >> >> --> intX >> >> 10.66 >> > > Y

Re: Python Newbie

2013-02-24 Thread Roy Smith
In article , Ethan Furman wrote: > On 02/24/2013 03:38 PM, piterrr.dolin...@gmail.com wrote: > > > >>> intX = 32 # decl + init int var > >> How is it not obvious that "intX" is an integer *without* the comment? > > > > Indeed the assignment is enough to deduce "intX" is

Re: Python Newbie

2013-02-24 Thread Steven D'Aprano
On Sun, 24 Feb 2013 16:08:01 -0500, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> > no need to remember what's an object and what's not -- everything is >> > an object > > Well, not quite everything. If I write: > > if foo: >do_this() >and_this() > > the code block ma

Re: Python Newbie

2013-02-24 Thread Ethan Furman
On 02/24/2013 04:08 PM, piterrr.dolin...@gmail.com wrote: For example (I believe it's already been mentioned) "declaring" intX with some integer value does *nothing* to maintain X as an integer: --> intX = 32 --> intX = intX / 3.0 --> intX 10.66 Yes I did see that it is possible

Re: Python Newbie

2013-02-24 Thread Mark Lawrence
On 25/02/2013 00:08, piterrr.dolin...@gmail.com wrote: For example (I believe it's already been mentioned) "declaring" intX with some integer value does *nothing* to maintain X as an integer: --> intX = 32 --> intX = intX / 3.0 --> intX 10.66 Yes I did see that it is possible to

Re: Python Newbie

2013-02-24 Thread Joshua Landau
On 25 February 2013 00:08, wrote: > > For example (I believe it's already been mentioned) "declaring" intX > with some integer value does *nothing* to maintain > > > > X as an integer: > > > > --> intX = 32 > > > > --> intX = intX / 3.0 > > > > --> intX > > > > 10.66 > > > > Yes I did see

Re: Python Newbie

2013-02-24 Thread piterrr . dolinski
> For example (I believe it's already been mentioned) "declaring" intX with > some integer value does *nothing* to maintain > > X as an integer: > > --> intX = 32 > > --> intX = intX / 3.0 > > --> intX > > 10.66 > Yes I did see that it is possible to redefine the type of a variable

Re: Python Newbie

2013-02-24 Thread Ethan Furman
On 02/24/2013 03:38 PM, piterrr.dolin...@gmail.com wrote: intX = 32 # decl + init int var How is it not obvious that "intX" is an integer *without* the comment? Indeed the assignment is enough to deduce "intX" is an int. The comment is there to let me know it is unl

Re: Python Newbie

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 10:38 AM, wrote: > >>> intX = 32 # decl + init int var >> How is it not obvious that "intX" is an integer *without* the comment? > > Indeed the assignment is enough to deduce "intX" is an int. The comment is > there to let me know it is unlikely i

Re: Python Newbie

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 9:33 AM, Ethan Furman wrote: > On 02/24/2013 12:58 PM, Chris Angelico wrote: >> >> On Mon, Feb 25, 2013 at 7:34 AM, Ethan Furman wrote: >>> >>> >>>- no variable declarations, just use 'em >> >> >> Variable declarations can go either way; Python requires you to name >>

Re: Python Newbie

2013-02-24 Thread piterrr . dolinski
>> intX = 32 # decl + init int var > How is it not obvious that "intX" is an integer *without* the comment? Indeed the assignment is enough to deduce "intX" is an int. The comment is there to let me know it is unlikely intX appears earlier in the code. Please, let me do

Re: Python Newbie

2013-02-24 Thread Albert Hopkins
> Most of what gets hung in art galleries these days is far less > visually pleasing than well-written code. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Newbie

2013-02-24 Thread Joshua Landau
On 24 February 2013 23:18, Oscar Benjamin wrote: > On 24 February 2013 21:35, Joshua Landau > wrote: > > > > determinant = b**2 - 4*a*c > > It's called the discriminant. A determinant is something altogether > different. *cries at own idiocy* Thank you. -- http://mail.python.org/mailman/listi

Re: Python Newbie

2013-02-24 Thread Joshua Landau
On 24 February 2013 22:08, Chris Angelico wrote: > On Mon, Feb 25, 2013 at 8:35 AM, Joshua Landau > wrote: > > def solve_quadratic(a, b, c): > > """Solve a quadratic equation of the form ax² + bx + c = 0 > > > > The result will be a tuple of the two results; the results can be equal > if > > the

Re: Python Newbie

2013-02-24 Thread Joshua Landau
On 24 February 2013 22:43, wrote: > Josh, > > Not thank you for your malicious post. > Be careful, us programmers do *eventually* catch on to who is a troll, and if you say things like that we may eventually mark you off as just to hostile. I *honestly* meant no malice or insult. If you can't ta

Re: Python Newbie

2013-02-24 Thread Joel Goldstick
On Sun, Feb 24, 2013 at 5:43 PM, wrote: > Josh, > > Not thank you for your malicious post. > I think you are missing the point here. > > My source code was just a dummy to offer context for the question I wanted > to ask. Further down the line, if I ever feel I don't need to > pseudo-declare vari

Re: Python Newbie

2013-02-24 Thread Dave Angel
On 02/24/2013 10:46 AM, piterrr.dolin...@gmail.com wrote: Hi guys, Question. Have this code intX = 32 # decl + init int var intX_asString = None # decl + init with NULL string var None is not a str, and it's not a "NULL string var" Perhaps what you wa

Re: Python Newbie

2013-02-24 Thread piterrr . dolinski
Josh, Not thank you for your malicious post. I think you are missing the point here. My source code was just a dummy to offer context for the question I wanted to ask. Further down the line, if I ever feel I don't need to pseudo-declare variables I will stop doing it. But for the moment I am tr

Re: Python Newbie

2013-02-24 Thread Ethan Furman
On 02/24/2013 12:58 PM, Chris Angelico wrote: On Mon, Feb 25, 2013 at 7:34 AM, Ethan Furman wrote: - no variable declarations, just use 'em Variable declarations can go either way; Python requires you to name all globals that you mutate I'm not sure what you mean -- example? -- ~Ethan~

Re: Python Newbie

2013-02-24 Thread Mitya Sirenef
On 02/24/2013 04:44 PM, Chris Angelico wrote: On Mon, Feb 25, 2013 at 8:08 AM, Roy Smith wrote: >> In article , >> Chris Angelico wrote: >> no need to remember what's an object and what's not -- everything is an object > > Careful on the citations - Ethan Furman said that, I just

Re: Python Newbie

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 8:35 AM, Joshua Landau wrote: > def solve_quadratic(a, b, c): > """Solve a quadratic equation of the form ax² + bx + c = 0 > > The result will be a tuple of the two results; the results can be equal if > the determinant is 0. > This supports imaginary results for if the det

Re: Python Newbie

2013-02-24 Thread Joshua Landau
On 24 February 2013 20:48, Roy Smith wrote: > In article , > Chris Angelico wrote: > > > On Mon, Feb 25, 2013 at 7:34 AM, MRAB > wrote: > > > Some languages require parentheses, others don't. > > > > > > C does. C++, Java and C# are descended from, or influenced by, C. > > > > > > Algol didn't

Re: Python Newbie

2013-02-24 Thread Joshua Landau
On 24 February 2013 19:29, wrote: > Hi. Steve, I don't know where you have been over the past couple of days > but it is widely known (if the thread title is any indication) that I am > indeed very new to Python, but not new to programming in general. > > To give a bit of background where I found

Re: Python Newbie

2013-02-24 Thread Roy Smith
In article , Chris Angelico wrote: > > no need to remember what's an object and what's not -- everything is an > > object Well, not quite everything. If I write: if foo: do_this() and_this() the code block making up the body of the "if" statement is not an object. In some languages,

Re: Python Newbie

2013-02-24 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Feb 25, 2013 at 7:34 AM, MRAB wrote: > > Some languages require parentheses, others don't. > > > > C does. C++, Java and C# are descended from, or influenced by, C. > > > > Algol didn't (doesn't?). Pascal, Modula-2, Oberon, Ada, and others > > don't.

Re: Python Newbie

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 7:34 AM, Ethan Furman wrote: > One of the things I love about Python is its ability to get out of the way > and let me work: > > - no variable declarations, just use 'em > - no type declarations, just use 'em > - no need to remember what's an object and what's not --

Re: Python Newbie

2013-02-24 Thread Ethan Furman
On 02/24/2013 11:40 AM, piterrr.dolin...@gmail.com wrote: Back in the day when C was king, or take many newer long established languages (C#, Java), the use of () has been widespread and mandated by the compilers. I have never heard anyone moan about the requirement to use parentheses. Now come

Re: Python Newbie

2013-02-24 Thread Mark Lawrence
On 24/02/2013 19:40, piterrr.dolin...@gmail.com wrote: if (some statement):# short form rather than if (some statement == true):# long form What all those ugly brackets are for? Mark, Back in the day when C was king, or take many newer long established languages (C#, Jav

Re: Python Newbie

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 7:34 AM, MRAB wrote: > Some languages require parentheses, others don't. > > C does. C++, Java and C# are descended from, or influenced by, C. > > Algol didn't (doesn't?). Pascal, Modula-2, Oberon, Ada, and others > don't. > > Parentheses are used where required, but not us

Re: Python Newbie

2013-02-24 Thread MRAB
On 2013-02-24 19:40, piterrr.dolin...@gmail.com wrote: if (some statement):# short form rather than if (some statement == true):# long form What all those ugly brackets are for? Mark, Back in the day when C was king, or take many newer long established languages (C#, Java

Re: Python Newbie

2013-02-24 Thread Michael Ross
On Sun, 24 Feb 2013 20:40:05 +0100, wrote: > if (some statement): # short form > > rather than > > if (some statement == true): # long form What all those ugly brackets are for? Mark, Back in the day when C was king, or take many newer long established languages (C#,

Re: Python Newbie

2013-02-24 Thread Chris Angelico
On Mon, Feb 25, 2013 at 5:19 AM, Grant Edwards wrote: > On 2013-02-23, Chris Angelico wrote: > >> It's worth noting, though, that there are self-perpetuating aspects to >> it. I can happily distribute a .py file to a Linux audience, because >> many Linux distros come with a Python already install

Re: Python Newbie

2013-02-24 Thread Mitya Sirenef
On 02/24/2013 02:40 PM, piterrr.dolin...@gmail.com wrote: if (some statement): # short form >>> >>> rather than >>> >>> if (some statement == true): # long form >> >> >> What all those ugly brackets are for? >> > > Mark, > > Back in the day when C was king, or take many newer long established >

Re: Python Newbie

2013-02-24 Thread piterrr . dolinski
> > if (some statement):# short form > > > > rather than > > > > if (some statement == true):# long form > > > What all those ugly brackets are for? > Mark, Back in the day when C was king, or take many newer long established languages (C#, Java), the use of () has bee

Re: Python Newbie

2013-02-24 Thread piterrr . dolinski
> To demonstrate that the person who wrote this code was not a good Python > > programmer. I hope it wasn't you :-) This person obviously had a very > > basic, and confused, understanding of Python. > > > > And, quite frankly, was probably not a very good programmer of *any* > > language:

  1   2   3   4   5   >