Chris Angelico wrote:
+0 for an easier way to import multiple submodules at once. It's not
something I've personally had a need for, but it's a sane and logical
thing to do.
Maybe:
import display, event, mixer in pygame
or
in pygame import display, event, mixer
--
Greg
If this was for a school assignment, I'd probably go to edit distance and
fuzzy string match next:
https://en.wikipedia.org/wiki/Edit_distance
https://en.wikipedia.org/wiki/String-to-string_correction_problem
- https://pypi.org/search/?q=Levenshtein
- https://pypi.org/project/textdistance/
As
I just ran into a similar problem, how to relatively import without binding
the submodule.
Let's say you have this :
myapp/
urls.py
views/
base.py
When you're in urls.py and you want to relatively access Functions from
base.py, you must use the from syntax.
from .views import
On Thu, Apr 26, 2018 at 11:53 PM, Julian DeMille via Python-ideas
wrote:
> That's the kind of thing I'm looking for. I've dealt with some library
> authors who were highly against importing the root allowing me to access
> submodules with hierarchy.
With a package,
26.04.18 16:51, Nick Coghlan пише:
Forcing submodule imports would be the main thing, as at the moment,
you have to choose between repeating the base name multiple times
(once per submodule) or losing the hierarchical namespace.
If the base name is short, there are no problems with repeating
The following works today:
Python 3.6.3 (default, Oct 4 2017, 06:09:15)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> os
There are two ‘AA’ in ‘AAA’, one starting from 0 and the other starting from 1.
If ‘AA’ starting from 0 is deleted and inserted with ‘BANAN’, ‘AAA’ becomes
‘BANANA ‘.
If ‘AA’ starting from 1 is deleted and inserted with ‘PPLE’, ‘AAA’ becomes
‘APPLE’.
Depending on which one is chosen, ‘AAA’
That's the kind of thing I'm looking for. I've dealt with some library
authors who were highly against importing the root allowing me to access
submodules with hierarchy.
On Thu, Apr 26, 2018 at 9:51 AM Nick Coghlan wrote:
> On 26 April 2018 at 23:37, Paul Moore
On 26 April 2018 at 23:37, Paul Moore wrote:
> On 26 April 2018 at 14:29, Julian DeMille via Python-ideas
> wrote:
>> I personally would like a feature where instead of doing `from ... import
>> ...` (which imports the specified items into the
On Thu, 26 Apr 2018 at 19:10 Julian DeMille via Python-ideas <
python-ideas@python.org> wrote:
> Some library authors get pretty pissy about implicit imports at the root
>
> On Thu, Apr 26, 2018, 09:37 Paul Moore wrote:
>
>> On 26 April 2018 at 14:29, Julian DeMille via
Some library authors get pretty pissy about implicit imports at the root
On Thu, Apr 26, 2018, 09:37 Paul Moore wrote:
> On 26 April 2018 at 14:29, Julian DeMille via Python-ideas
> wrote:
> > I personally would like a feature where instead of
On 26 April 2018 at 14:29, Julian DeMille via Python-ideas
wrote:
> I personally would like a feature where instead of doing `from ... import
> ...` (which imports the specified items into the current namespace), one
> could use something along the lines of `import .{ , ,
I personally would like a feature where instead of doing `from ... import
...` (which imports the specified items into the current namespace), one
could use something along the lines of `import .{ , , ...
}` such that the imported modules/attributes could be accessed as
`.`, etc.
--
Thanks,
On 26 April 2018 at 19:37, Jacco van Dorp wrote:
> I'm kind of curious why everyone here seems to want to use IntFlags
> and other mixins. The docs themselves say that their use should be
> minimized, and tbh I agree with them. Backwards compatiblity can be
> maintained by
or build it yourself...
def str_count(string, sub):
c = 0
for c in range(len(string)-len(sub)):
if string[c:].startswith(sub):
c += 1
return c
(probably some optimizations possible...)
Or in one line with a generator expression:
def str_count(string, sub):
return
I'm kind of curious why everyone here seems to want to use IntFlags
and other mixins. The docs themselves say that their use should be
minimized, and tbh I agree with them. Backwards compatiblity can be
maintained by allowing the old value and internally converting it to
the enum. Combinability is
>> It could be great. But I afraid this may add too much complexity in C
code. Maybe try to implement a simple and fast Enum for using it in the
stdlib and extend it with a richer interface in the enum module?
> I think we can do something similar to ABCMeta, i.e. the metaclass itself
will stay
On Thu, 26 Apr 2018 08:38:43 +0100
Ivan Levkivskyi
wrote:
> On 25 April 2018 at 12:01, Serhiy Storchaka
> wrote:
>
> > 25.04.18 13:15, Ivan Levkivskyi пише:
> >
> >> Hm, this is what I wanted to know. I think by
On 25 April 2018 at 12:01, Serhiy Storchaka wrote:
> 25.04.18 13:15, Ivan Levkivskyi пише:
>
>> Hm, this is what I wanted to know. I think by rewriting EnumMeta in C we
>> can reduce the creation time of an Enum class
>> (almost) down to the creation time of a normal class,
On Wednesday, April 25, 2018, Steven D'Aprano wrote:
> On Wed, Apr 25, 2018 at 11:22:24AM -0700, Julia Kim wrote:
> > Hi,
> >
> > There’s an error with the string method count().
> >
> > x = ‘AAA’
> > y = ‘AA’
> > print(x.count(y))
> >
> > The output is 1, instead of 2.
>
>
Even if not just for the autocompletion, it would be more explicit
that it's not just a random string like you'd pass to print(), but it
has a specific meaning. Something in PEP 20 about explicit and
implicit ?
Autocompletion might be a good advantage, but 1) the IDE would need to
know what to
21 matches
Mail list logo