Re: NLTK

2018-08-06 Thread Steven D'Aprano
tion isn't called "word-tokenize". That would mean "word subtract tokenize" in Python code. Do you mean word_tokenize? Have you compared the output of the two and looked at how they differ? If there is too much output to compare by eye, you could convert to sets and ch

RFC -- custom operators

2018-08-07 Thread Steven D'Aprano
es where the code is improved and made more expressive by using operator syntax and existing operators aren't sufficient. (If there aren't any such use-cases, then there's no need for custom operators.) Thoughts? -- Steven D'Aprano "Ever since I learned ab

Re: name 'aLOCK' is not defined When I add aLOCK = threading.RLock() behind if __name__ == "__main__"

2018-08-09 Thread Steven D'Aprano
>> global. > > When something goes wrong in an unexpected way: test your assumptions > ;-) xuanwu348's assumptions are correct. aLock is a global, in both positions. The problem is not the scope of the variable, but whether or not the variable is assigned to or not. --

Re: Can't figure out how to do something using ctypes (and maybe struct?)

2018-08-10 Thread Steven D'Aprano
(Events) 508 Unless that's what you intended, you ought to move the class outside of the function. class Events(ctypes.Structure): _fields_ = [ ... ] def mkVstEvents(events): return Events( ... ) -- Steven D'Aprano "Ever since I learned about confirmati

Re: Python-Tkinter issue. Multiple overlaping event routines called by single click

2018-08-11 Thread Steven D'Aprano
seems like an interesting experiment... put time.sleep(0.3) at the end of the event handler and see what happens. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Python-Tkinter issue. Multiple overlaping event routines called by single click

2018-08-11 Thread Steven D'Aprano
m/a/12357536 but since the description of the problem is so vague, it is hard to tell exactly what's happening. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Pylint false positives

2018-08-14 Thread Steven D'Aprano
o locals works inside the class body. locals()[name] = inner del inner, name # Clean up the class namespace. def concrete_method_a(self): ... although to be honest I'm not sure if that would be enough to stop PyLint from complaining. -- Steven D'Aprano "

Re: Pylint false positives

2018-08-15 Thread Steven D'Aprano
On Tue, 14 Aug 2018 15:18:13 +, Jon Ribbens wrote: > On 2018-08-14, Steven D'Aprano > wrote: >> If there really are a lot of such missing methods, I'd consider writing >> something like this: >> >> class A: >> def __init__(self, ...): &

Re: Program to output a subset of the composite numbers

2018-08-15 Thread Steven D'Aprano
starting with: [] [] [8, 9] [] [14, 15] etc. Take care though: I have not tested this code. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Pylint false positives

2018-08-16 Thread Steven D'Aprano
so in practice, I probably wouldn't switch to a factory solution for merely four methods with empty bodies. But I certainly would for eight. When making this trade-off, "my developers don't understand Python's execution model or its dynamic features" is not a good reason to stick to large amounts of mindless code. That's a good reason to send the developer in question to a good Python course to update their skills. (Of course if you can't do this for political or budget reasons, I sympathise.) -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Pylint false positives

2018-08-16 Thread Steven D'Aprano
using a separate method per subclass does exactly what I > want, and that part of my project has been working stably for some time. You might consider using single dispatch instead: https://docs.python.org/3/library/functools.html#functools.singledispatch -- Steven D'Aprano "Ever

Re: Pylint false positives

2018-08-17 Thread Steven D'Aprano
On Fri, 17 Aug 2018 11:49:01 +, Jon Ribbens wrote: > On 2018-08-17, Steven D'Aprano > wrote: >> On the other hand, your objection to the following three idioms is as >> good an example of the Blurb Paradox as I've ever seen. > > Do you mean the Blub Parad

Re: Pylint false positives

2018-08-17 Thread Steven D'Aprano
tates the intention "These methods are identical except in their name" more strongly than creating them in a loop? -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Pylint false positives

2018-08-18 Thread Steven D'Aprano
that means no decorators, no closures, no introspection ("reflection" in Java terms), no metaclasses (other than type), no use of descriptors (other than the built-in ones), no template- based programming, no source-code generators. No namedtuples, Enums, or data-classes. -- Stev

Re: Pylint false positives

2018-08-18 Thread Steven D'Aprano
In practice I wouldn't even consider this for three methods. Six or eight seems like a reasonable cut-of point for me, but it depends on the specifics of the code and who I was writing it for. (Note that this makes me much more conservative than the usual advice given by system admins, when

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-18 Thread Steven D'Aprano
h, the penny drops* ... Are you trying to generate the keys by using nested loops? for i in range(1000): # up to some maximum value for j in range(1000): for k in range(1000): for l in range(1000): key = "FEq_({0},_{1},_{2},_{3})".format(i,j,k,l)

Re: Pylint false positives

2018-08-19 Thread Steven D'Aprano
On Sun, 19 Aug 2018 11:43:44 +0300, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Sun, 19 Aug 2018 00:11:30 +0300, Marko Rauhamaa wrote: >> >>> In Python programming, I mostly run into closures through inner >>> classes (as in Java). >> >>

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-19 Thread Steven D'Aprano
Feq_(i,_j,_k,_l)'] = temp If you want to leave the original in place and do something else with the result: result = varsdict['Feq_(i,_j,_k,_l)'] * A[i,j,k,l] print(result) -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-19 Thread Steven D'Aprano
On Sun, 19 Aug 2018 03:35:24 -0700, giannis.dafnomilis wrote: > On Sunday, August 19, 2018 at 3:53:39 AM UTC+2, Steven D'Aprano wrote: [...] >> If you know absolutely for sure that the key format is ALWAYS going to >> be 'FEq_()' then you can extract the fiel

Writing bytes to stdout reverses the bytes

2018-08-19 Thread Steven D'Aprano
| hexdump 000 84fd 0804 000a 005 -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: How to multiply dictionary values with other values based on the dictionary's key?

2018-08-19 Thread Steven D'Aprano
9, 'FEq_(0,_0,_3,_0)': } If you run print(varsdict) what does it show? (I have limited time to respond at the moment, so apologies for the brief answers. Hopefully someone else will step in with some help too.) -- Steven D'Aprano "Ever since I learned about

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Steven D'Aprano
On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: > When I write bytes to stdout, why are they reversed? Answer: they aren't, use hexdump -C. Thanks to all replies! -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing i

Re: Pylint false positives

2018-08-20 Thread Steven D'Aprano
> statement, which is clearly worse than executing a def statement (0.1 > µs) or integer addition (0.05 µs). However, 7 microseconds is the least > of my programming concerns. And fair enough... premature optimization and all that. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Pylint false positives

2018-08-20 Thread Steven D'Aprano
ers in this way :-( (Not that I do this using "inner classes", but I do often want to use a class as a container for functions, without caring about "self" or wrapping everything in staticmethod.) -- Steven D'Aprano "Ever since I learned about confirmation bias,

Re: Idle

2018-08-20 Thread Steven D'Aprano
On Mon, 20 Aug 2018 14:46:32 +0400, NAB NAJEEB wrote: > Hi am a beginner can u tell me where can I write my codes I already > tried pycharm and atom.. both are not worked successfully always shows > error...pls guide me... What errors do they show? -- Steven D'Aprano "E

Re: Pylint false positives

2018-08-20 Thread Steven D'Aprano
On Mon, 20 Aug 2018 22:55:26 +0300, Marko Rauhamaa wrote: > Dan Sommers : > >> On Mon, 20 Aug 2018 14:39:38 +, Steven D'Aprano wrote: >>> I have often wished Python had proper namespaces, so I didn't have to >>> abuse classes as containers in this wa

Re: Pylint false positives

2018-08-21 Thread Steven D'Aprano
asses and instances come with inheritance, self etc which is great if you want a class, but if you just want a simple module-like namespace without the extra file, classes are a pretty poor alternative. But they're all we've got. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Partitioning a list

2018-08-21 Thread Steven D'Aprano
library/itertools.html -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Pylint false positives

2018-08-21 Thread Steven D'Aprano
oids closures altogether but we don't know the full requirements here and its hard to judge from the outside on why Marko picked the design he has and whether its a good idea. It could be a case of "ooh, closures are a shiny new hammer, this problem must be a nail!" but let's give him the benefit of the doubt and assume he has good reasons, not just reasons. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Generating a specific list of intsgers

2018-08-24 Thread Steven D'Aprano
tarted? (I am an amateur) That's more a maths question than a programming question. Find out how to tackle it mathematically, and then we can code it. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about floating point

2018-08-29 Thread Steven D'Aprano
if you want a guard digit), a rounding mode (Banker's Rounding is recommended for financial applications), and just do your calculations with no "clever tricks". Add two numbers, then add tax: money = (a+b)*(1+t/100) compared to the "clever trick": money =

Re: Question about floating point

2018-08-29 Thread Steven D'Aprano
nction: Or better still, DON'T manually use the round function, let the interpreter do the rounding for you by using Decimal. That's what its for. Why in the name of all that's holy would anyone want to manually round each and every intermediate calculation when they could use the

Re: Question about floating point

2018-08-30 Thread Steven D'Aprano
On Thu, 30 Aug 2018 19:22:29 +1200, Gregory Ewing wrote: > Steven D'Aprano wrote: >> Why in the name of all that's holy would anyone want to manually round >> each and every intermediate calculation when they could use the Decimal >> module and have it do it a

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-08-30 Thread Steven D'Aprano
calls your scripts. There are many choices: tkinter is provided in the Python standard library, but some people prefer wxPython, PyQT4, or other GUI toolkits. https://duckduckgo.com/?q=python+gui+toolkits -- Steven D'Aprano "Ever since I learned about confirmation bias, I'

Re: __init__ patterns

2018-08-30 Thread Steven D'Aprano
to make this a hard rule? Did anyone mention what the standard library does? Check out the dbm, logging, html, http, collections, importlib, and curses packages (and probably others): https://github.com/python/cpython/tree/3.7/Lib -- Steven D'Aprano "Ever since I learned

Re: Question about floating point

2018-08-31 Thread Steven D'Aprano
On Fri, 31 Aug 2018 18:45:16 +1200, Gregory Ewing wrote: > Steven D'Aprano wrote: >> The right way is to >> set the rounding mode at the start of your application, and then let >> the Decimal type round each calculation that needs rounding. > > It's not

Re: Question about floating point

2018-09-01 Thread Steven D'Aprano
;>> >>>> > The first two format methods behave as expected. The old-style '%' > operator does not. The % operator casts the argument to a (binary) float. The other two don't need to, because they call Decimal's own format method. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Any SML coders able to translate this to Python?

2018-09-04 Thread Steven D'Aprano
rn 2*r+1 but I don't understand the let ... in part so I'm not sure if I'm doing it right. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Any SML coders able to translate this to Python?

2018-09-05 Thread Steven D'Aprano
*r+1 but I don't understand the let ... in part so I'm not sure if I'm doing it right. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Why emumerated list is empty on 2nd round of print?

2018-09-06 Thread Steven D'Aprano
n you need it, not to hold on to the reference for later. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: don't quite understand mailing list

2018-09-06 Thread Steven D'Aprano
27;m speaking up now because your reply to Reto is unwelcoming, unhelpful and disrespectful, and coming from a moderator who has been known to ban people, that makes it even more hostile. [1] Yes, there are such things as stupid questions. If your doctor asked you "remind me again, whic

Re: Object-oriented philosophy

2018-09-06 Thread Steven D'Aprano
;t use a "bare" except, i.e. one that doesn't > specify what exception(s) it should catch. Excellent advice! More here: https://realpython.com/the-most-diabolical-python-antipattern/ -- Steven D'Aprano "Ever since I learned about confirmation bias, I've

Re: Any SML coders able to translate this to Python?

2018-09-07 Thread Steven D'Aprano
On Thu, 06 Sep 2018 13:48:54 +0300, Marko Rauhamaa wrote: > Chris Angelico : >> The request was to translate this into Python, not to slavishly imitate >> every possible semantic difference even if it won't actually affect >> behaviour. > > I trust Steven to b

Re: Object-oriented philosophy

2018-09-07 Thread Steven D'Aprano
e on the day. That will often be the "get" method. But on the rare occasions I do care about performance, the basic rule of thumb I use is that if the key is likely to be missing more than about 10% of the time, I use the "LBYL" idiom (either an explicit test using "if key

Re: don't quite understand mailing list

2018-09-07 Thread Steven D'Aprano
s not ridicule.) -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list

Re: Any SML coders able to translate this to Python?

2018-09-07 Thread Steven D'Aprano
On Fri, 07 Sep 2018 15:10:10 +0100, Paul Moore wrote: > On Fri, 7 Sep 2018 at 14:06, Steven D'Aprano > wrote: [...] >> However I have a follow up question. Why the "let" construct in the >> first place? Is this just a matter of principle, "put everyth

Trying to use threading.local()

2018-09-12 Thread Steven D'Aprano
_bootstrap_inner self.run() File "/usr/local/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "", line 5, in worker AttributeError: '_thread._local' object has no attribute 'value' What am I doing w

So apparently I've been banned from this list

2018-09-30 Thread Steven D'Aprano
ime, I may not reply on-list to any responses. Subject: Fwd: Temporary Suspension To: From: Ethan Furman Date: Tue, 11 Sep 2018 11:22:40 -0700 In-Reply-To: Steven, you've probably already seen this on Python List, but I forgot to email it directly to you. My apologies. -- ~Ethan~ Python Lis

Re: List of Functions

2016-03-28 Thread Steven D'Aprano
tion. "Classless object" is an oxymoron in Python since all values without exception have a class. Can you explain what you mean? Also, for the benefit of those who aren't Java coders, what do you mean by "Java's syntactic innovation"? >>> And I always curs

Re: List of Functions

2016-03-28 Thread Steven D'Aprano
back to Alonzo Church, who in the 1930's started with a "hat" symbol; he wrote the square function as "ŷ . y × y". But frustrated typographers moved the hat to the left of the parameter and changed it to a capital lambda: "Λy . y × y"; from there the capital l

Learning Python (or Haskell) makes you a worse programmer

2016-03-28 Thread Steven D'Aprano
http://lukeplant.me.uk/blog/posts/why-learning-haskell-python-makes-you-a-worse-programmer/ -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Useless expressions [was Re: Undefined behaviour in C]

2016-03-29 Thread Steven D'Aprano
On Monday 28 March 2016 23:18, BartC wrote: > On 28/03/2016 02:24, Steven D'Aprano wrote: >> Don't think about floats and ints and strings. Think of complex objects >> with operator overloading. You're probably thinking of `x + y`. Instead, >> think of things

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-29 Thread Steven D'Aprano
On Monday 28 March 2016 12:40, Paul Rubin wrote: > Steven D'Aprano writes: >> if condition: >> print(1) >> print(2) >> else: >> print(3) >> print(4) >> what value should it return? Justify your choice. > > It could wha

Re: Threading is foobared?

2016-03-29 Thread Steven D'Aprano
On Tue, 29 Mar 2016 09:26 pm, Sven R. Kunze wrote: > On 27.03.2016 05:01, Steven D'Aprano wrote: >> Am I the only one who has noticed that threading of posts here is >> severely broken? It's always been the case that there have been a few >> posts here and there t

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-29 Thread Steven D'Aprano
On Tue, 29 Mar 2016 10:31 pm, BartC wrote: > On 29/03/2016 09:26, Steven D'Aprano wrote: >> On Monday 28 March 2016 12:40, Paul Rubin wrote: > > >> The point is that there's nothing intrinsically obvious or right about >> "return the value of the las

Re: Calculate Bill

2016-03-29 Thread Steven D'Aprano
ou calculate the total: sum(prices) -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-29 Thread Steven D'Aprano
iki/Bijection,_injection_and_surjection If somebody wants to insist that this is a kind of mapping, I can't disagree, but it isn't useful as a mapping type. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-29 Thread Steven D'Aprano
On Wednesday 30 March 2016 16:43, Steven D'Aprano wrote: > This is not an argument about dicts being mutable, because clearly they > aren't. Er, I meant *immutable*. Dicts aren't immutable. -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Steven D'Aprano
On Wed, 30 Mar 2016 06:12 pm, Jussi Piitulainen wrote: > Steven D'Aprano writes: > >> Given a surjection (many-to-one mapping) > > No. And I doubt that Wikipedia says that. No to what? What are you disagreeing with? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Steven D'Aprano
On Wed, 30 Mar 2016 09:28 pm, Jussi Piitulainen wrote: > Steven D'Aprano writes: > >> On Wed, 30 Mar 2016 06:12 pm, Jussi Piitulainen wrote: >> >>> Steven D'Aprano writes: >>> >>>> Given a surjection (many-to-one mapping) >>> &

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Steven D'Aprano
and contrived examples such as this do not count: class MyDict(dict): def values(self): for value in super().values(): yield value yield object() # It's a value without a key! -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: sympy

2016-03-30 Thread Steven D'Aprano
;) > > print(f(3)) This code seems to work perfectly to me. You differentiate an expression, then substitute the 'x' variable for 't': -2*t/(t**2 + 1)**2 What were you expecting? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: sympy

2016-03-30 Thread Steven D'Aprano
ained what you *actually* wanted, because I was going to guess that you wanted to evaluate the derivative at x = 3: py> ftext.evalf(subs={x:3}) -0.06000000 -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Steven D'Aprano
On Thu, 31 Mar 2016 12:12 am, Antoon Pardon wrote: > Op 30-03-16 om 14:22 schreef Steven D'Aprano: [...] >> Why is a mapping (such as a dict) best described as a surjection? >> Consider: >> >> d = {1: None, 2: 'a', 3: 'b', 4: None} >>

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Steven D'Aprano
gt; > Javascript seems to manage it just fine. I wouldn't exactly hold Javascript up as the exemplar of intelligent design decisions. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Steven D'Aprano
assert mapping["george"] != "27 Main Road" No hypothetical cases where somebody might or could want this behaviour. I'm not interested in "mights" and "coulds". I want to see an actual application where adding a new key to a mapping is expected to change the other keys. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Steven D'Aprano
ollections.abc.Mapping): it = obj.items elif isinstance(obj, collections.abc.Sequence): it = enum(obj) else: raise TypeError('not a sequence or a mapping') yield from it Pick which one you prefer, stick it in your own personal toolbox of useful utili

Re: Threading is foobared?

2016-03-30 Thread Steven D'Aprano
On Thursday 31 March 2016 15:50, Mark Sapiro wrote: > Hi all, > > I'm jumping in on this thread because Tim asked. [...] Thanks for the explanation! -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Steven D'Aprano
On Thursday 31 March 2016 13:45, Paul Rubin wrote: > Steven D'Aprano writes: >> I want to see an actual application where adding a new key to a .^ >> mapping is expected to change the other keys. > directory["mary.roommate"]

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Steven D'Aprano
d dicts. So, Antoon, no, I don't have to justify a single thing. If you want this change, you have to justify why it should be done. Good luck with that. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Pyscripter Issues

2016-03-31 Thread Steven D'Aprano
that, you'll soon find out whether Python itself is working. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Slice equivalent to dict.get

2016-03-31 Thread Steven D'Aprano
[] To get a default: py> L[5:6] or -1 -1 This is short and simple enough to use in place, but we can also wrap this into a convenient helper function: def get(seq, index, default=None): return (seq[index:index+1] or [default])[0] py> get(L, 2, -1) 8 py> get(L, 200, -1) -1 -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: The next major Python version will be Python 8

2016-03-31 Thread Steven D'Aprano
pedia.org/wiki/Swatch_Internet_Time -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Issue with opening a python file

2016-03-31 Thread Steven D'Aprano
ave to post it to imgur or similar, and secondly, a screen-shot is of no use to anyone using a screen reader. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-04-01 Thread Steven D'Aprano
the 1988 C standard." A: "Surely you aren't serious?" But most people don't bother passing ideas through here first, they just go straight to Python-Ideas. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange range

2016-04-01 Thread Steven D'Aprano
except with more error checking, better bounds checking, support for the `in` operator, etc. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Drowning in a teacup?

2016-04-01 Thread Steven D'Aprano
ey): del mylist[i] mylist.insert(0, x) or if you prefer: for i, x in enumerate(mylist): if x.startswith(key): mylist[:] = [x] + mylist[:i] + mylist[i+1:] -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange range

2016-04-02 Thread Steven D'Aprano
s is analogous > with the difference between C's arrays and pointers.) I don't understand this analogy. Can you explain please? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: [beginner] What's wrong?

2016-04-02 Thread Steven D'Aprano
pupel.plaese(pupel.resolts) Google translate suggests Marko's code means: for pupil in class: if pupil.abandoned(): pupil.please(pupil.results) -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: [beginner] What's wrong?

2016-04-02 Thread Steven D'Aprano
On Sun, 3 Apr 2016 03:12 am, Thomas 'PointedEars' Lahn wrote: > Marko Rauhamaa wrote: > >> Steven D'Aprano : >>> So you're saying that learning to be a fluent speaker of English is a >>> pre-requisite of being a programmer? >> >> N

Re: [beginner] What's wrong?

2016-04-02 Thread Steven D'Aprano
hurts reaction time. I ask people a question, and they don't reply for a week or at all, because they're too busy playing games all day. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Drowning in a teacup?

2016-04-02 Thread Steven D'Aprano
h points to another thing": - C pointers (memory addresses); - some form of managed reference to a memory location; - classic Mac OS "handles" (managed pointers-to-pointers); - or even integer indexes into a giant array, like early versions of Fortran. But that hardly means that pointers are a feature of the Java language. > This holds no matter what > kind of object is passed in or what mutable properties it has or does > not have. I'm still not getting your point. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Failed to update the os.environ with subprocess.Popen.

2016-04-02 Thread Steven D'Aprano
only with Popen. What makes you think that Popen objects have a split() method? They are not documented as having this method: https://docs.python.org/2/library/subprocess.html https://docs.python.org/3/library/subprocess.html https://pymotw.com/2/subprocess/ -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange range

2016-04-02 Thread Steven D'Aprano
ethod was removed in 2002.) Discussion and feature request in 2007: "We really ought to fix that slow performance of (x)range membership testing..." http://bugs.python.org/issue1766304 So it's one of those things on the border of useful or not. Those who use it, miss it when its gon

Re: Strange range

2016-04-02 Thread Steven D'Aprano
On Sun, 3 Apr 2016 02:43 pm, Steven D'Aprano wrote: > If you personally don't see any advantage in this, so be it, but you might > not be aware of the history of (x)range: > > Guido in 2001: "..." Correction: these are not direct quotes, but paraphrases

Re: [beginner] What's wrong?

2016-04-02 Thread Steven D'Aprano
ctet" is a slightly more precise term than > "byte", meaning exactly 8 bits (whereas "byte" could > theoretically mean something else depending on the > context). "Theoretically"? http://stackoverflow.com/questions/2098149/what-platforms-have-something-other

Re: module alias in import statement

2016-04-04 Thread Steven D'Aprano
; inside that same directory; - execute that file "tkinter/ttk.py" (for example" to create a module object; - create a local variable "ttk" bound to that module object. So you can see why this doesn't work: import tkinter as tk import tk.ttk as ttk is looki

Re: troubleshooting

2016-04-04 Thread Steven D'Aprano
are deleted. Please copy and paste the text of the error, if you can. Otherwise, if it is short, please retype it into your message. If it is too long to retype, you can upload your screen shot to Imgur and then link to that. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

IDLE's subprocess didn't make connection. Either IDLE can't start or personal firewall software is blocking connection.

2016-04-04 Thread Steven Gao
I’m getting “IDLE's subprocess didn't make connection. Either IDLE can't start or personal firewall software is blocking connection.”. Any ideas? Sent from Mail for Windows 10 --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus -- https://m

Re: Best Practices for Internal Package Structure

2016-04-04 Thread Steven D'Aprano
anyway in order to > really explicit about what the public API is. """ Does his team not do internal code reviews? I hate code that lies about where it comes from. I certainly wouldn't do it in a futile attempt to protect idiots from themselves. > Curious what folks on this list recommend, or if there are best practices > about this published somewhere. > > Thanks, > Josh -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Plot/Graph

2016-04-04 Thread Steven D'Aprano
lines of code, to do your work for you? For free? We try to be friendly and helpful, but there are limits. Please read this before replying: http://www.sscce.org/ Thank you. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: How can I install

2016-04-04 Thread Steven D'Aprano
How are you running it? - type "python" into a command shell? - double-click an icon on the desktop? - choose "Python" from the Start menu? - something else? The more detail you can give, the better the chances we can help you. If you give no detail, we can give no help. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: module alias in import statement

2016-04-05 Thread Steven D'Aprano
On Tuesday 05 April 2016 14:27, Rustom Mody wrote: > On Tuesday, April 5, 2016 at 9:53:30 AM UTC+5:30, Chris Angelico wrote: >> On Tue, Apr 5, 2016 at 2:08 PM, Rustom Mody wrote: >> >> 'import tk.ttk' looks for 'tk' in sys.modules, does not find it, looks >> >> for a module named 'tk' on disk, do

Re: Import error

2016-04-05 Thread Steven D'Aprano
S. Bad question, with no useful answers: Question: "It doesn't work! What am I doing wrong" -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Import graphics error

2016-04-05 Thread Steven D'Aprano
GraphicsWindow > ImportError: cannot import name 'GraphicsWindow' How did you install it? Are you sure it is the right module? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Install request

2016-04-05 Thread Steven D'Aprano
on Windows. > > +10 on that one > ie When a question becomes a FAQ just put it there Would somebody who knows Windows actually do this and then post the link here please? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Best Practices for Internal Package Structure

2016-04-05 Thread Steven D'Aprano
On Wed, 6 Apr 2016 03:38 am, Sven R. Kunze wrote: > On 05.04.2016 03:43, Steven D'Aprano wrote: >> The purpose of packages isn't enable Java-style "one class per file" >> coding, especially since *everything* in the package except the top level >> "b

Re: Best Practices for Internal Package Structure

2016-04-05 Thread Steven D'Aprano
file. And > that should do it. :) None of which ought to be part of the package itself. Well, perhaps the README. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: python script for .dat file

2016-04-05 Thread Steven D'Aprano
9d formats an integer in nine columns, justified on the left, while %9d justifies to the right: py> print("%-9d." % 23) 23 . py> print("%9d." % 23) 23. Finally, the line is printed so you can see what it looks like, and written to the file. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Import graphics error

2016-04-05 Thread Steven D'Aprano
faqs/smart-questions.html> Why oh why can't somebody write "How to write smart answers" for people like "Pointed Ears"? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

<    27   28   29   30   31   32   33   34   35   36   >