Re: Noob question: Is all this typecasting normal?

2009-01-17 Thread Aahz
[following up late] In article 2b3c916e-6908-4b12-933f-8f7bfa86c...@i20g2000prf.googlegroups.com, Russ P. russ.paie...@gmail.com wrote: Fair enough, but for code that is not intended for general public usage (i.e., most code) so-called camelCase is every bit as good if not better than using

Re: Noob question: Is all this typecasting normal?

2009-01-17 Thread Steven D'Aprano
On Sat, 17 Jan 2009 06:09:29 -0800, Aahz wrote: You are missing the point: suppose you write a useful library in your air traffic management application, maybe one that does a good job of handling user input. If you have done a proper job of abstracting it from your application as a whole,

Re: Noob question: Is all this typecasting normal?

2009-01-17 Thread Tim Rowe
2009/1/3 Russ P. russ.paie...@gmail.com: So unless you think the standard library will someday include code for air traffic management, I'll stick with camelCase, and I'll thank you for not making an issue of it. Another late comment, sorry, but as an air traffic management safety consultant,

Re: Noob question: Is all this typecasting normal?

2009-01-06 Thread vk
Anyone have something to say about the userio stuff? (If you're going to post something about my coding style, I invite you to do something infinitely more useful: write crapToPep8.py {or is it crap_to_pep8?} to satisfy your sick fetish for consistency.) --

Re: Noob question: Is all this typecasting normal?

2009-01-06 Thread J Kenneth King
Gabriel Genellina gagsl-...@yahoo.com.ar writes: En Mon, 05 Jan 2009 02:03:26 -0200, Roy Smith r...@panix.com escribió: The other day, I came upon this gem. It's a bit of perl embedded in a Makefile; this makes it even more gnarly because all the $'s get doubled to hide them from make:

Re: Noob question: Is all this typecasting normal?

2009-01-05 Thread Gabriel Genellina
En Mon, 05 Jan 2009 02:03:26 -0200, Roy Smith r...@panix.com escribió: The other day, I came upon this gem. It's a bit of perl embedded in a Makefile; this makes it even more gnarly because all the $'s get doubled to hide them from make: define absmondir $(shell perl -e ' \                

Re: Noob question: Is all this typecasting normal?

2009-01-04 Thread alex goretoy
My gmail did that. FYI, it wasn't intentional. А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я Paula Poundstone - I don't have a bank account because I don't know my mother's maiden name. On Sun, Jan 4, 2009 at

Re: Noob question: Is all this typecasting normal?

2009-01-04 Thread sprad
On Jan 3, 6:41 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: The OP comes from a Perl background, which AFAIK allows you to concat numbers to strings and add strings to numbers. That's probably the (mis) feature he was hoping Python had. That's correct -- and that's been one

Re: Noob question: Is all this typecasting normal?

2009-01-04 Thread Roy Smith
In article cc87ebf5-5ce1-4fb5-bb2d-cd4bc2426...@q36g2000vbn.googlegroups.com, sprad jsp...@gmail.com wrote: On Jan 3, 6:41 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: The OP comes from a Perl background, which AFAIK allows you to concat numbers to strings and add

Re: Noob question: Is all this typecasting normal?

2009-01-04 Thread James Mills
On Mon, Jan 5, 2009 at 1:47 PM, sprad jsp...@gmail.com wrote: On Jan 3, 6:41 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: The OP comes from a Perl background, which AFAIK allows you to concat numbers to strings and add strings to numbers. That's probably the (mis) feature

Re: Noob question: Is all this typecasting normal?

2009-01-03 Thread Bruno Desthuilliers
sprad a écrit : I've done a good bit of Perl, but I'm new to Python. I find myself doing a lot of typecasting (or whatever this thing I'm about to show you is called), Actually, it's just plain object instanciation. and I'm wondering if it's normal, or if I'm missing an important idiom.

Re: Noob question: Is all this typecasting normal?

2009-01-03 Thread Russ P.
On Jan 2, 10:50 pm, Ben Finney bignose+hates-s...@benfinney.id.au wrote: s0s...@gmail.com writes: On Jan 2, 7:20 pm, Ben Finney bignose+hates-s...@benfinney.id.au wrote: They don't need to be creative; they merely need to conform with the naming scheme as laid out in the PEP. If it's

Re: Noob question: Is all this typecasting normal?

2009-01-03 Thread alex goretoy
for each his own. Any more word on userio? On Sat, Jan 3, 2009 at 6:14 PM, Russ P. russ.paie...@gmail.com wrote: On Jan 2, 10:50 pm, Ben Finney bignose+hates-s...@benfinney.id.aubignose%2bhates-s...@benfinney.id.au wrote: s0s...@gmail.com writes: On Jan 2, 7:20 pm, Ben Finney

Re: Noob question: Is all this typecasting normal?

2009-01-03 Thread vk
Any more word on userio? None yet, I'm afraid. Should've started a different thread for it - but it's stuck here (in obscurity) forever xd. -- http://mail.python.org/mailman/listinfo/python-list

Re: Noob question: Is all this typecasting normal?

2009-01-03 Thread Steven D'Aprano
On Sat, 03 Jan 2009 20:35:25 +, alex goretoy wrote: for each his own. Please don't top-post. Please don't quote the ENTIRE body of text (PLUS doubling it by including a completely useless HTML version) just to add a trivial comment. Trim the text you are replying to. Any more word on

Re: Noob question: Is all this typecasting normal?

2009-01-03 Thread Steven D'Aprano
On Sat, 03 Jan 2009 16:19:58 +0100, Bruno Desthuilliers wrote: But indeed, you obviously cannot add strings with numerics nor concatenate numerics with strings. This would make no sense. The OP comes from a Perl background, which AFAIK allows you to concat numbers to strings and add strings

Noob question: Is all this typecasting normal?

2009-01-02 Thread sprad
I've done a good bit of Perl, but I'm new to Python. I find myself doing a lot of typecasting (or whatever this thing I'm about to show you is called), and I'm wondering if it's normal, or if I'm missing an important idiom. For example: bet = raw_input(Enter your bet) if int(bet) == 0: #

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Benjamin Kaplan
On Fri, Jan 2, 2009 at 4:15 PM, sprad jsp...@gmail.com wrote: I've done a good bit of Perl, but I'm new to Python. I find myself doing a lot of typecasting (or whatever this thing I'm about to show you is called), and I'm wondering if it's normal, or if I'm missing an important idiom. For

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Diez B. Roggisch
sprad schrieb: I've done a good bit of Perl, but I'm new to Python. I find myself doing a lot of typecasting (or whatever this thing I'm about to show you is called), and I'm wondering if it's normal, or if I'm missing an important idiom. It is normal, although below you make things

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread TechieInsights
You can use the built-in string formatting options and operations. 2.5: http://www.python.org/doc/2.5.2/lib/typesseq-strings.html 2.6: http://docs.python.org/library/string.html In essence, you can do: print You still have $%i remaining %(money) On Jan 2, 2:15 pm, sprad jsp...@gmail.com wrote:

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread vk
You might better do bet = int(raw_input(Enter your bet)) because then you don't need to later on convert bet again and again. This is all fine until you give it to an end-user. This is what I picture: $ ./script.py Enter your bet: $10 .. or perhaps ten, all, or a jillion other tainted

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Andreas Waldenburger
On Fri, 2 Jan 2009 14:36:04 -0800 (PST) vk vmi...@gmail.com wrote: There needs to be a user_io or sanitize module in the standard library to take care of this stuff. [snip example] Great idea! +1 ... but there isn't, as far as I know. Well, get to it, then. ;) /W -- My real email

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread r
There needs to be a user_io or sanitize module in the standard library to take care of this stuff. [snip] +1 You are sooo right. You know, it is easy to forget about such things after you learn a language, i have written my own input logic, but i remember my __init__ days with python now and

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Ben Finney
vk vmi...@gmail.com writes: There needs to be a user_io or sanitize module in the standard library to take care of this stuff. Like: import userio logic = userio.userio() number = logic.getNumeric(blah: ) # will offer the user a re-do in case of bad input number =

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread vk
If there were, I would expect it to conform with PEP 8 (get those ugly camelCase names outta there :-) haha, please forgive me. I'll try and think of some more creative names. atm, I've got a chem final to study for. I'll probably post something resembling useful code tomorrow morning. until

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Andreas Waldenburger
On Fri, 2 Jan 2009 16:16:10 -0800 (PST) vk vmi...@gmail.com wrote: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase names outta there :-) haha, please forgive me. I'll try and think of some more creative names. FYI: The names themselves aren't he problem

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread r
On Jan 2, 6:26 pm, Andreas Waldenburger geekm...@usenot.de wrote: On Fri, 2 Jan 2009 16:16:10 -0800 (PST) vk vmi...@gmail.com wrote: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase names outta there :-)   haha, please forgive me. I'll try and think of

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Andreas Waldenburger
On Fri, 2 Jan 2009 16:44:11 -0800 (PST) r rt8...@gmail.com wrote: On Jan 2, 6:26 pm, Andreas Waldenburger geekm...@usenot.de wrote: On Fri, 2 Jan 2009 16:16:10 -0800 (PST) vk vmi...@gmail.com wrote: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread John Machin
On Jan 3, 11:16 am, vk vmi...@gmail.com wrote: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase names outta there :-) haha, please forgive me. I'll try and think of some more creative names. atm, I've got a chem final to study for. I'll probably post

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Ben Finney
vk vmi...@gmail.com writes: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase names outta there :-) haha, please forgive me. I'll try and think of some more creative names. They don't need to be creative; they merely need to conform with the naming scheme

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Steve Holden
Ben Finney wrote: vk vmi...@gmail.com writes: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase names outta there :-) haha, please forgive me. I'll try and think of some more creative names. They don't need to be creative; they merely need to conform with

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread s0suk3
On Jan 2, 7:20 pm, Ben Finney bignose+hates-s...@benfinney.id.au wrote: vk vmi...@gmail.com writes: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase names outta there :-) haha, please forgive me. I'll try and think of some more creative names. They

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread r
On Jan 2, 6:57 pm, Andreas Waldenburger geekm...@usenot.de wrote: [snip] You even assumed that distinction in your example: 'hello world.title() [snip] sorry, here is TitleCase.py_b2 py 'hello world'.title().replace(' ', '') -- http://mail.python.org/mailman/listinfo/python-list

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Steven D'Aprano
On Fri, 02 Jan 2009 21:02:19 -0500, Steve Holden wrote: Ben Finney wrote: vk vmi...@gmail.com writes: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase names outta there :-) haha, please forgive me. I'll try and think of some more creative names. They

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Russ P.
On Jan 2, 6:15 pm, s0s...@gmail.com wrote: On Jan 2, 7:20 pm, Ben Finney bignose+hates-s...@benfinney.id.au wrote: vk vmi...@gmail.com writes: If there were, I would expect it to conform with PEP 8 (get those ugly camelCase names outta there :-) haha, please forgive me. I'll

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread vk
etc etc ... IOW consider not biting off more than you can chew. It's possible that I am, but where's the fun without the risk? Good thinking in your post though! I will add get_date at some point, and I've modified get_numeric already. All-right, the moment you've all been waiting for:

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread Ben Finney
s0s...@gmail.com writes: On Jan 2, 7:20 pm, Ben Finney bignose+hates-s...@benfinney.id.au wrote: They don't need to be creative; they merely need to conform with the naming scheme as laid out in the PEP. If it's something to be included in the standard library, I agree (just for

Re: Noob question: Is all this typecasting normal?

2009-01-02 Thread vk
Unless you explicitly *never* intend sharing your code with *anyone*, it's best to code all your Python code in accordance with PEP 8 anyway. Well said. Let's bury the puppy already. Anyone have something to say about the userio stuff? -- http://mail.python.org/mailman/listinfo/python-list