Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Gene Heskett
On Tuesday 08 April 2014 20:23:05 Chris Angelico did opine: > On Wed, Apr 9, 2014 at 1:14 AM, Gene Heskett wrote: > > Ditto, but make it 65 years in electronics for me. > > > >> -People make you feel like an idiot when you ask a question and they > >> intimidate you so you don't come back and as

Re: Keeping track of things with dictionaries

2014-04-08 Thread Ian Kelly
On Tue, Apr 8, 2014 at 9:31 PM, Gene Heskett wrote: >> 'Pneumonoultramicroscopicsilicovolcanoconiosis' has them all beat. > > Source citation please? http://en.wikipedia.org/wiki/Pneumonoultramicroscopicsilicovolcanoconiosis http://www.oxforddictionaries.com/definition/english/pneumonoultramicros

Re: "Latching" variables in function

2014-04-08 Thread Terry Reedy
On 4/8/2014 4:09 PM, Grawburg wrote: I've probably used the wrong term - I'm thinking of what I do when writing PLC code - so I can't find how to do this in my reference books. This is part of a project I'm working on with a Raspberry Pi and an MCP23017 port expander. I have a N/O pushbutton t

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Terry Reedy
On 4/8/2014 12:44 PM, Steven D'Aprano wrote: http://michaelochurch.wordpress.com/2012/04/13/java-shop-politics/ Thank you for posting this. I read several more. I especially found this interesting: http://michaelochurch.wordpress.com/2012/08/26/xwp-vs-jap/ in which he concludes that one ro

Re: Keeping track of things with dictionaries

2014-04-08 Thread Gene Heskett
On Tuesday 08 April 2014 23:31:35 Ian Kelly did opine: > On Tue, Apr 8, 2014 at 8:45 PM, alex23 wrote: > > On 9/04/2014 12:33 PM, Chris Angelico wrote: > >>> Unfortunately I seem to be missing antidisestablishmentarianism, > >>> because the longest words in my dict are only 24 characters, > >>> e

Re: Keeping track of things with dictionaries

2014-04-08 Thread Ian Kelly
On Tue, Apr 8, 2014 at 8:45 PM, alex23 wrote: > On 9/04/2014 12:33 PM, Chris Angelico wrote: >>> >>> Unfortunately I seem to be missing antidisestablishmentarianism, >>> because the longest words in my dict are only 24 characters, >>> excluding the '\n'. Should I ask for my money back? >> >> >> I

Re: Keeping track of things with dictionaries

2014-04-08 Thread alex23
On 9/04/2014 12:33 PM, Chris Angelico wrote: Unfortunately I seem to be missing antidisestablishmentarianism, because the longest words in my dict are only 24 characters, excluding the '\n'. Should I ask for my money back? I think you should. That's a fundamental flaw in the dictionary. Everyon

Re: Keeping track of things with dictionaries

2014-04-08 Thread alex23
On 8/04/2014 6:31 PM, Frank Millman wrote: Here is an idea, inspired by Peter Otten's suggestion earlier in this thread. Instead of defaultdict, subclass dict and use __missing__() to supply the default values. When the dictionary is set up, delete __missing__ from the subclass! Ugly, but it see

Re: Keeping track of things with dictionaries

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 10:43 AM, Gregory Ewing wrote: > Chris Angelico wrote: >> >> in the dictionary I >> have here (Debian Wheezy, using an American English dictionary - it's >> a symlink to (ultimately) /usr/share/dict/american-english), there are >> five entries in that list. > > > Mine's bigg

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 10:39 AM, alex23 wrote: >> int > > > Shorthand for 'integerise'. Not at all. "Integrate". It's a vital mathematical operation, that's why you always get a number back. ... I'll get my coat, too. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: threading

2014-04-08 Thread Rustom Mody
On Wednesday, April 9, 2014 4:02:10 AM UTC+5:30, Sturla Molden wrote: > On 08/04/14 22:30, Grant Edwards wrote: > >>> Unix maybe, but what about Windows? Is it efficient to create > >>> processes under Windows? > >> Processes are very heavy-weight on Windows. > > Not surprising given its VMS herit

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 6:19 AM, James Brewer wrote: > On Tue, Apr 8, 2014 at 12:47 PM, Rick Johnson > wrote: >>[ a whole lot of typical stuff ] > > You're an interesting fellow. Rick's one of our resident... uhh... characters. Don't take his words to heart. > Also, I didn't graduate; I dropped

Re: threading

2014-04-08 Thread Rick Johnson
A overview of the Py-Venactular used in this thread: by Professor Rick # Finny Said:# # "Threading is very difficult to get right

Re: "Latching" variables in function

2014-04-08 Thread Ethan Furman
On 04/08/2014 01:09 PM, Grawburg wrote: I've probably used the wrong term - I'm thinking of what I do when writing PLC code - so I can't find how to do this in my reference books. This is part of a project I'm working on with a Raspberry Pi and an MCP23017 port expander. I have a N/O pushbutto

Re: Keeping track of things with dictionaries

2014-04-08 Thread Gregory Ewing
Chris Angelico wrote: in the dictionary I have here (Debian Wheezy, using an American English dictionary - it's a symlink to (ultimately) /usr/share/dict/american-english), there are five entries in that list. Mine's bigger than yours! On MacOSX 10.6 I get 41 words. (I think someone must have f

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-08 Thread alex23
On 8/04/2014 6:21 PM, Steven D'Aprano wrote: Functions which are intended to return a value may be named as verbs: [...] or as nouns: int Shorthand for 'integerise'. str 'stringify' dict 'dictionarate' coordinate array These are both verbs. ...I'll get me coat. -- https://mail.

Re: "Latching" variables in function

2014-04-08 Thread Denis McMahon
On Tue, 08 Apr 2014 16:09:28 -0400, Grawburg wrote: > def button(): >    pushbutton = 0 >   button_value = 0 >    pushbutton=bus.read_byte_data(address,GPIOB) >    if pushbutton > 0: >         button_value = 1 >    return button_value Every time your function is called, you start out with button_

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread alex23
On 9/04/2014 3:29 AM, Chris Angelico wrote: My code would make for terrible PHP. :) Don't feel bad about that. It's a truism for every language, including PHP. -- https://mail.python.org/mailman/listinfo/python-list

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Marc Lucke
On 9/04/2014 5:47 AM, Rick Johnson wrote: On Tuesday, April 8, 2014 2:07:27 AM UTC-5, James Brewer wrote: I'm sure there will be a substantial amount of arrogance perceived from this question, but frankly I don't think that I have anything to learn from my co-workers, which saddens me because I

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread James Brewer
On Tue, Apr 8, 2014 at 12:47 PM, Rick Johnson wrote: > > Judging from your childish optimism and bombastic > expectations that the onerous of scholastic achievements lay > solely in the prowess of your teacher, i can only conclude > that you are yet another recent graduate of one of the > "fine uni

"Latching" variables in function

2014-04-08 Thread Grawburg
I've probably used the wrong term - I'm thinking of what I do when writing PLC code - so I can't find how to do this in my reference books. This is part of a project I'm working on with a Raspberry Pi and an MCP23017 port expander. I have a N/O pushbutton that I want to "latch" a value to a vari

Re: threading

2014-04-08 Thread Sturla Molden
On 08/04/14 22:30, Grant Edwards wrote: Unix maybe, but what about Windows? Is it efficient to create processes under Windows? Processes are very heavy-weight on Windows. Not surprising given its VMS heritage. I remember running shell scripts under VMS on a VAX-11/780 that took hours to do

Re: Scoping rules for class definitions

2014-04-08 Thread Rotwang
On 04/04/2014 19:55, Ian Kelly wrote: On Fri, Apr 4, 2014 at 12:37 PM, Rotwang wrote: Hi all. I thought I had a pretty good grasp of Python's scoping rules, but today I noticed something that I don't understand. Can anyone explain to me why this happens? x = 'global' def f1(): x = 'loca

Re: Python 2.3 and ODBC

2014-04-08 Thread Mark Lawrence
On 08/04/2014 21:18, Gabor Urban wrote: Hi guys, [snip] BTW if my demo will be good, we hope to have an aproval to change to Python 3.3 Why 3.3? 3.4 has just been released and has lots of new batteries, so why not use them? Thanks in advance -- Urbán Gábor Linux is like a wigwam: n

Re: Python 2.3 and ODBC

2014-04-08 Thread Tim Chase
On 2014-04-08 22:18, Gabor Urban wrote: > I am using Python 2.3 on an XP box at my company. (I know it is > quite outdated, but we could not make the management to upgrade.) I > have started a pilot project the last week to show the possibility > of processing incoming XML files and extracting data

Re: threading

2014-04-08 Thread Grant Edwards
On 2014-04-08, Sturla Molden wrote: > On 07/04/14 05:56, Chris Angelico wrote: >> On Mon, Apr 7, 2014 at 1:48 PM, Roy Smith wrote: >>> There is (or at least, was) another reason. Creating a new process used >>> to be far more expensive than creating a new thread. In modern Unix >>> kernels, ho

Re: Python 2.3 and ODBC

2014-04-08 Thread Larry Martell
On Tue, Apr 8, 2014 at 4:18 PM, Gabor Urban wrote: > Hi guys, > > I am using Python 2.3 on an XP box at my company. (I know it is quite > outdated, but we could not make the management to upgrade.) I have started a > pilot project the last week to show the possibility of processing incoming > XML

Python 2.3 and ODBC

2014-04-08 Thread Gabor Urban
Hi guys, I am using Python 2.3 on an XP box at my company. (I know it is quite outdated, but we could not make the management to upgrade.) I have started a pilot project the last week to show the possibility of processing incoming XML files and extracting data into Oracle tables. Now I am almost

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread James Brewer
I'm in the Bay Area and I did actually go to a Django meetup yesterday in SF where there were talks revolving around large-scale Django applications. It was very informative. :) On Tue, Apr 8, 2014 at 10:16 AM, Joel Goldstick wrote: > Check meetup.com. I live in nyc where there are django, pytho

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Rick Johnson
On Tuesday, April 8, 2014 2:07:27 AM UTC-5, James Brewer wrote: > I'm sure there will be a substantial amount of arrogance > perceived from this question, but frankly I don't think > that I have anything to learn from my co-workers, which > saddens me because I really like to learn and I know that

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread James Brewer
On Tue, Apr 8, 2014 at 7:28 AM, Larry Martell wrote: > -People are on crazy deadlines and have no time to work with you. > > > -People make you feel like an idiot when you ask a question and they > intimidate you so you don't come back and ask more. > Both of these issues exist; mainly on the pa

Re: threading

2014-04-08 Thread Sturla Molden
On 07/04/14 05:56, Chris Angelico wrote: On Mon, Apr 7, 2014 at 1:48 PM, Roy Smith wrote: There is (or at least, was) another reason. Creating a new process used to be far more expensive than creating a new thread. In modern Unix kernels, however, the cost difference has become much less, so

Re: threading

2014-04-08 Thread Ethan Furman
On 04/06/2014 08:56 PM, Chris Angelico wrote: On Mon, Apr 7, 2014 at 1:48 PM, Roy Smith wrote: There is (or at least, was) another reason. Creating a new process used to be far more expensive than creating a new thread. In modern Unix kernels, however, the cost difference has become much les

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Wolfgang Keller
> Things I'm interested include contributing to both Python and Django, > database design and data modeling, Django is made by people who definitely don't know what they're doing. https://code.djangoproject.com/wiki/MultipleColumnPrimaryKeys Open the index to any half-decent database design text

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 3:45 AM, wrote: >> """ “I’m going to put wings on a [bleep] tank”. > > class FairchildA10(... Ah yes, the Warthog. You might call one ugly, but it'll just call you dead... ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread pecore
> """ “I’m going to put wings on a [bleep] tank”. class FairchildA10(... -- https://mail.python.org/mailman/listinfo/python-list

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 3:25 AM, Steven D'Aprano wrote: > Now be kind! It's not that Chris' code was bad, but obviously Pike is > such a rubbish language that it's all but untranslatable... > > :-P Now that's completely not true! Translating Pike into PHP is by definition easy. Look: // Pike code

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Steven D'Aprano
On Tue, 08 Apr 2014 17:19:46 +, alister wrote: > On Wed, 09 Apr 2014 01:48:52 +1000, Chris Angelico wrote: > >> I managed to convince him to let me use Pike for a lot of the work, >> though I suspect that - now that we're no longer working together - >> he's ripping a lot of it out in favour

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 3:19 AM, alister wrote: > On Wed, 09 Apr 2014 01:48:52 +1000, Chris Angelico wrote: > >> I managed to convince him to let me use Pike for a lot of the work, >> though I suspect that - now that we're no longer working together - >> he's ripping a lot of it out in favour of ei

Re: threading

2014-04-08 Thread Marko Rauhamaa
Sturla Molden : > No, 10,000 processes will not do. I never suggested that. In fact, I'm on the record recommending about two processes per CPU core. There are many principles on which to allocate threads/processes: objects, tasks, stimulus sources, CPUs. I'm advocating CPUs. If you use nonbloc

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread alister
On Wed, 09 Apr 2014 01:48:52 +1000, Chris Angelico wrote: > I managed to convince him to let me use Pike for a lot of the work, > though I suspect that - now that we're no longer working together - > he's ripping a lot of it out in favour of either PHP or JavaScript. > And that's a job I wouldn't

Re: threading

2014-04-08 Thread Sturla Molden
Paul Rubin wrote: > Sturla Molden writes: >> When should we use C++ or Fortran instead of Python? Ever? > > When performance matters? Sometimes, but usually performance only matters in certain types of calculations like matrix algebra or FFTs. But we always use specialized libraries for that,

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 2:44 AM, Steven D'Aprano wrote: > On Wed, 09 Apr 2014 01:38:42 +1000, Chris Angelico wrote: > -People are super patient and helpful and they answer all your questions and go beyond the call of duty to help you. >>> >>> A utopia very few will ever find. >> >> In cor

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Joel Goldstick
Check meetup.com. I live in nyc where there are django, python groups. Maybe where you live too On Apr 8, 2014 12:45 PM, "Steven D'Aprano" < steve+comp.lang.pyt...@pearwood.info> wrote: > On Wed, 09 Apr 2014 01:38:42 +1000, Chris Angelico wrote: > > >>> -People are super patient and helpful and th

Re: threading

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 2:46 AM, Paul Rubin wrote: > Sure, and that implies that making people wait for computer results > costs you. If a C++ program can run in 2 seconds while the equivalent > Python script would take a minute, the Python version loses the user's > attention and they have to bur

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Steven D'Aprano
On Wed, 09 Apr 2014 01:38:42 +1000, Chris Angelico wrote: >>> -People are super patient and helpful and they answer all your >>> questions and go beyond the call of duty to help you. >> >> A utopia very few will ever find. > > In corporate, yes, it's rare. But it's a lot less rare in open source

Re: threading

2014-04-08 Thread Sturla Molden
Marko Rauhamaa wrote: > Queues are fine if you hermetically insulate your objects. IOW, you > group your objects in single-threaded pseudoprocesses that don't make > any direct method calls to each other. If you do that, you might as well > use real processes. That way, you can even naturally enf

Re: threading

2014-04-08 Thread Paul Rubin
Sturla Molden writes: > When should we use C++ or Fortran instead of Python? Ever? When performance matters? > There is a reason scientists are running Python on even the biggest > supercomputers today. They use Python as a scripting wrapper around numerics libraries written in compiled langua

Re: threading

2014-04-08 Thread Paul Rubin
Sturla Molden writes: > As it turns out, if you try hard enough, you can always construct a race > condition, deadlock or a livelock. If you need to guard against it, there > is paradigms like BSP, but not everything fits in. a BSP design. Software transactional memory (STM) may also be of intere

Re: threading

2014-04-08 Thread Sturla Molden
alister wrote: > My main point was that when you have only 8K of ROM & 128 byte of ram you > have to think about your algorithms first. And that also happens if you have a 32 bit system, with just 2 GB of memory available to user space (the operating system reserves the upper half of the 4 GB a

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 1:44 AM, Larry Martell wrote: > On Tue, Apr 8, 2014 at 11:33 AM, Chris Angelico wrote: >> He was majorly turned off >> by the whole thing of significant whitespace and basically just told >> me "there will be no Python here". Bah.) > > I had programmed in perl for 20 years,

Re: threading

2014-04-08 Thread Sturla Molden
Roy Smith wrote: > Thread 1 and Thread 2 use a pair of queues to communicate. T1 sends > work to T2 using Q1, and T2 sends back results using Q2. > > T1 pushes Item1 onto Q1, and waits for Result1 to come back on Q2. > > T2 reads Item1 from its end of Q1, and waits to read Item2, which it >

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Larry Martell
On Tue, Apr 8, 2014 at 11:33 AM, Chris Angelico wrote: > He was majorly turned off > by the whole thing of significant whitespace and basically just told > me "there will be no Python here". Bah.) I had programmed in perl for 20 years, then got a job at place where the boss made the edict "There

Re: threading

2014-04-08 Thread Sturla Molden
Roy Smith wrote: > Let's say I've got a program which consumes 60 GB of RAM, so I'm renting > the 2xlarge instance to run it. My software architect could recode the > program to be more efficient, and fit into just 30 GB, saving me > $3000/year. How much of his time is it worth to do that?

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 1:14 AM, Gene Heskett wrote: > Ditto, but make it 65 years in electronics for me. > >> -People make you feel like an idiot when you ask a question and they >> intimidate you so you don't come back and ask more. > > That generally only happens a couple times, I am good at mak

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 1:10 AM, Larry Martell wrote: > Or: The boss is a former programmer, perhaps even a very good one, but > he's not at all involved with the day to day issues, but still wants > to tell you how to do things. Heh. The boss was a bit like that at my last job. Kept telling me st

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Gene Heskett
On Tuesday 08 April 2014 10:52:39 Larry Martell did opine: > On Tue, Apr 8, 2014 at 3:07 AM, James Brewer wrote: > > I'm sure there will be a substantial amount of arrogance perceived > > from this question, but frankly I don't think that I have anything to > > learn from my co-workers, which sad

Re: threading

2014-04-08 Thread Sturla Molden
alister wrote: > As my only professional coding experience has been with embedded 8 bit > processors with limited resources i naturally abhorrent to the process of > "Just throw more RAM (Or any other resource for that matter)at it". I understand. I do not advocate threads for parallel i/o on

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Larry Martell
On Tue, Apr 8, 2014 at 11:02 AM, Chris Angelico wrote: > On Wed, Apr 9, 2014 at 12:28 AM, Larry Martell > wrote: >> I've worked at places where: > > Add to that list: > > - Some of the programmers really aren't programmers, but the boss just > hasn't figured it out yet. > > That was my last job,

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Wed, Apr 9, 2014 at 12:28 AM, Larry Martell wrote: > I've worked at places where: Add to that list: - Some of the programmers really aren't programmers, but the boss just hasn't figured it out yet. That was my last job, until said non-programmer decided to quit. ChrisA -- https://mail.pyth

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Larry Martell
On Tue, Apr 8, 2014 at 3:07 AM, James Brewer wrote: > I'm sure there will be a substantial amount of arrogance perceived from this > question, but frankly I don't think that I have anything to learn from my > co-workers, which saddens me because I really like to learn and I know that > I have a lo

Re: threading

2014-04-08 Thread alister
On Tue, 08 Apr 2014 23:23:05 +1000, Chris Angelico wrote: > On Tue, Apr 8, 2014 at 11:13 PM, Roy Smith wrote: >> And the cost of hardware keeps going down, while the cost of good >> programmers keeps going up. > > Like everything, it's a matter of trade-offs. Spending a moment thinking > about w

Re: change spacing to two instead of four with pep8 or flake8?

2014-04-08 Thread Peter Otten
Roy Smith wrote: > In article , > Peter Otten <__pete...@web.de> wrote: > >> Dennis wrote: >> >> > In Pylint you can change the spacing multiplier from 4 spaces to two >> > in its pylintrc, but for the life of me I cannot find a way to do this >> > with the flake8 / pep8 utilities. >> > >> > I

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Mark H Harris
On 4/8/14 2:07 AM, James Brewer wrote: I don't think that I have anything to learn from my co-workers, which saddens me because I really like to learn and I know that I have a lot of learning to do. Give it time. The first thing that must happen is relationship building. Initially its about

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Jason Swails
On Tue, Apr 8, 2014 at 3:07 AM, James Brewer wrote: > I'm sure there will be a substantial amount of arrogance perceived from > this question, but frankly I don't think that I have anything to learn from > my co-workers, which saddens me because I really like to learn and I know > that I have a l

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread alister
On Tue, 08 Apr 2014 13:47:12 +, Grant Edwards wrote: > On 2014-04-08, Chris Angelico wrote: >> On Tue, Apr 8, 2014 at 5:07 PM, James Brewer wrote: >> >>> Basically, I want to be a better engineer. Where can I find someone >>> willing to point me in the right direction and what can I offer in

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Tue, Apr 8, 2014 at 11:47 PM, Grant Edwards wrote: > You'll get genneraly get answers to: > [chomp] and the question "Did I spell everything correctly?", to which the answer is generally "No". :) ChrisA diving for cover... -- https://mail.python.org/mailman/listinfo/python-list

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Grant Edwards
On 2014-04-08, Chris Angelico wrote: > On Tue, Apr 8, 2014 at 5:07 PM, James Brewer wrote: > >> Basically, I want to be a better engineer. Where can I find someone >> willing to point me in the right direction and what can I offer in >> return? > > Right here on this list! And all you have to off

Re: change spacing to two instead of four with pep8 or flake8?

2014-04-08 Thread Roy Smith
In article , Peter Otten <__pete...@web.de> wrote: > Dennis wrote: > > > In Pylint you can change the spacing multiplier from 4 spaces to two > > in its pylintrc, but for the life of me I cannot find a way to do this > > with the flake8 / pep8 utilities. > > > > I want to avoid ignoring E111 al

Re: threading

2014-04-08 Thread Chris Angelico
On Tue, Apr 8, 2014 at 11:13 PM, Roy Smith wrote: > And the cost of hardware keeps going down, while the cost of > good programmers keeps going up. Like everything, it's a matter of trade-offs. Spending a moment thinking about what you're doing before you do it might cut your RAM usage by 20% wit

Re: threading

2014-04-08 Thread Roy Smith
In article , Sturla Molden wrote: > The problem here is the belief that "thread-safety cannot be abstracted > out". It can. The solution is to share nothing and send messages through > queues. Thread 1 and Thread 2 use a pair of queues to communicate. T1 sends work to T2 using Q1, and T2 sen

Re: threading

2014-04-08 Thread Roy Smith
In article , alister wrote: > > My personal feeling is that asynchronous i/o is mostly useful on 32-bit > > systems, and the problem it actually solves is the limited virtual > > address space. On a 64 bit system we can just throw more RAM at it and > > threads be fine. > > > As my only profess

Re: change spacing to two instead of four with pep8 or flake8?

2014-04-08 Thread Peter Otten
Dennis wrote: > In Pylint you can change the spacing multiplier from 4 spaces to two > in its pylintrc, but for the life of me I cannot find a way to do this > with the flake8 / pep8 utilities. > > I want to avoid ignoring E111 altogether if at all possible, because > it may catch other spacing p

Re: threading

2014-04-08 Thread Marko Rauhamaa
Sturla Molden : > The problem here is the belief that "thread-safety cannot be > abstracted out". It can. The solution is to share nothing and send > messages through queues. If you start to use mutexes and conditions > all over your code, you might shoot yourself in the foot, eventually. Queues

Re: change spacing to two instead of four with pep8 or flake8?

2014-04-08 Thread Tim Chase
On 2014-04-08 09:52, Chris “Kwpolska” Warrick wrote: > On Tue, Apr 8, 2014 at 5:06 AM, Dennis wrote: > > In Pylint you can change the spacing multiplier from 4 spaces to > > two in its pylintrc, but for the life of me I cannot find a way > > to do this with the flake8 / pep8 utilities. > > > > I w

Re: threading

2014-04-08 Thread alister
> My personal feeling is that asynchronous i/o is mostly useful on 32-bit > systems, and the problem it actually solves is the limited virtual > address space. On a 64 bit system we can just throw more RAM at it and > threads be fine. > As my only professional coding experience has been with embed

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-08 Thread Rustom Mody
On Tuesday, April 8, 2014 7:03:31 AM UTC+5:30, Mark H. Harris wrote: > I have another question for y'all, is a function (particularly a > generator) a noun or a verb? Does a function (or generator) 'do' > something (based on name and parms) or does it 'return' something based > on name and

Re: threading

2014-04-08 Thread Sturla Molden
Marko Rauhamaa wrote: > The main problems with threads include: > > * Thread-safety is rarely done right. Also, when it's done wrong, it >can be virtually impossible to fix it without a significant rewrite. >This is not a theoretical concern: I have had to deal with the >resulting n

Re: Keeping track of things with dictionaries

2014-04-08 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmppaqmb6no7udddadqg_jv9yz0sn4d70kasksbwwr3...@mail.gmail.com... > On Tue, Apr 8, 2014 at 7:28 PM, Frank Millman wrote: >> Are you saying that >> >> all([len(word) == 23 for word in words_by_length[23]]) # hope I got >> that right >> >> will not

Re: Keeping track of things with dictionaries

2014-04-08 Thread Chris Angelico
On Tue, Apr 8, 2014 at 7:28 PM, Frank Millman wrote: > Are you saying that > > all([len(word) == 23 for word in words_by_length[23]]) # hope I got > that right > > will not return True? That'll return true. What it won't show, though, is the length of the word as you would understand it in t

Re: Keeping track of things with dictionaries

2014-04-08 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmoRxEhX02ZviHiLO+qi+dD+81smbGGYcPECpHb5E=p4=a...@mail.gmail.com... > On Tue, Apr 8, 2014 at 6:26 PM, Frank Millman wrote: >>> words_by_length = {} >>> for word in open("/usr/share/dict/words"): >>>words_by_length.setdefault(len(word), []).append(

Re: Keeping track of things with dictionaries

2014-04-08 Thread Chris Angelico
On Tue, Apr 8, 2014 at 6:26 PM, Frank Millman wrote: >> words_by_length = {} >> for word in open("/usr/share/dict/words"): >>words_by_length.setdefault(len(word), []).append(word) >> >> This will, very conveniently, give you a list of all words of a >> particular length. (It's actually a littl

Re: Keeping track of things with dictionaries

2014-04-08 Thread Frank Millman
"Ian Kelly" wrote in message news:CALwzidmP5Bevbace9GyQrVXe-_2T=jtpq1yvapsaepvomqe...@mail.gmail.com... > On Tue, Apr 8, 2014 at 1:14 AM, Frank Millman wrote: >> >> It appears that when you use 'setdefault', the default is always >> evaluated, >> even if the key exists. >> >> It seems odd. Is

Re: Keeping track of things with dictionaries

2014-04-08 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmpk-rqx0fp6_4vxyus2z34vc5fq_qntj+q9+kn8y5u...@mail.gmail.com... > On Tue, Apr 8, 2014 at 5:14 PM, Frank Millman wrote: >> It appears that when you use 'setdefault', the default is always >> evaluated, >> even if the key exists. >> >> It seems odd. I

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-08 Thread Steven D'Aprano
On Mon, 07 Apr 2014 20:33:31 -0500, Mark H Harris wrote: > I have another question for y'all, is a function (particularly a > generator) a noun or a verb? Mu. http://en.wikipedia.org/wiki/Mu_%28negative%29#.22Unasking.22_the_question Nouns and verbs are concepts from a completely differe

Re: Keeping track of things with dictionaries

2014-04-08 Thread Peter Otten
Ian Kelly wrote: > One thing I will note as a disadvantage of defaultdict is that > sometimes you only want the default value behavior while you're > initially building the dict, and then you just want a normal dict with > KeyErrors from then on. defaultdict doesn't do that; once > constructed, i

Re: Keeping track of things with dictionaries

2014-04-08 Thread Chris Angelico
On Tue, Apr 8, 2014 at 5:14 PM, Frank Millman wrote: > It appears that when you use 'setdefault', the default is always evaluated, > even if the key exists. > def get_value(val): > ... print('getting value', val) > ... return val*2 > ... my_dict = {} my_dict.setdefault('a', get_

Re: change spacing to two instead of four with pep8 or flake8?

2014-04-08 Thread Chris “Kwpolska” Warrick
On Tue, Apr 8, 2014 at 5:06 AM, Dennis wrote: > Hi, > > In Pylint you can change the spacing multiplier from 4 spaces to two > in its pylintrc, but for the life of me I cannot find a way to do this > with the flake8 / pep8 utilities. > > I want to avoid ignoring E111 altogether if at all possible,

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Chris Angelico
On Tue, Apr 8, 2014 at 5:07 PM, James Brewer wrote: > Basically, I want to be a better engineer. Where can I find someone willing > to point me in the right direction and what can I offer in return? > Right here on this list! And all you have to offer in return is interesting questions. You ask t

Re: Keeping track of things with dictionaries

2014-04-08 Thread Ian Kelly
On Tue, Apr 8, 2014 at 1:14 AM, Frank Millman wrote: > > "Chris Angelico" wrote in message > news:captjjmqfbt2xx+bdfnhz0gagordkhtpbzrr29duwn36girz...@mail.gmail.com... >> On Tue, Apr 8, 2014 at 2:02 PM, Josh English >> wrote: >>> >>> Would dict.setdefault() solve this problem? Is there any advan

Re: Keeping track of things with dictionaries

2014-04-08 Thread Steven D'Aprano
On Tue, 08 Apr 2014 09:14:39 +0200, Frank Millman wrote: > It appears that when you use 'setdefault', the default is always > evaluated, even if the key exists. > def get_value(val): > ... print('getting value', val) > ... return val*2 > ... my_dict = {} my_dict.setdefault('a',

ANN: eGenix mxODBC 3.3.0 - Python ODBC Database Interface

2014-04-08 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Python ODBC Database Interface Version 3.3.0 mxODBC is our commercially supported Python extension providing

Re: Keeping track of things with dictionaries

2014-04-08 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmqfbt2xx+bdfnhz0gagordkhtpbzrr29duwn36girz...@mail.gmail.com... > On Tue, Apr 8, 2014 at 2:02 PM, Josh English > wrote: >> >> Would dict.setdefault() solve this problem? Is there any advantage to >> defaultdict over setdefault() > > That depends on

[OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread James Brewer
I'm sure there will be a substantial amount of arrogance perceived from this question, but frankly I don't think that I have anything to learn from my co-workers, which saddens me because I really like to learn and I know that I have a lot of learning to do. I've been employed as a software engine

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-08 Thread Antoon Pardon
On 07-04-14 07:10, Steven D'Aprano wrote: > >> Restricting the usage of Python's flexibility does not make it another >> language. It makes it the actual language that the vast majority of >> programs are written in and that people assume when reading code. > That's incorrect. If len were a keyword